1 2 3 4 5 6 7 8 9 10 11 12 13 14 15 16 17 18 19 20 21 22 23 24 25 26 27 28 29 30
|
From: Mariusz Felisiak <felisiak.mariusz@gmail.com>
Date: Sun, 28 Sep 2025 16:11:23 +0200
Subject: Skipped NOT NULL constraints on PostgreSQL 18+.
PostgreSQL 18+ stores column "NOT NULL" specifications in pg_constraint.
https://www.postgresql.org/docs/release/18.0/
Origin: upstream, https://github.com/django/django/pull/19910
Bug-Debian: https://bugs.debian.org/1117647
Last-Update: 2025-10-22
---
django/db/backends/postgresql/introspection.py | 4 +++-
1 file changed, 3 insertions(+), 1 deletion(-)
diff --git a/django/db/backends/postgresql/introspection.py b/django/db/backends/postgresql/introspection.py
index 69bc871..fb876df 100644
--- a/django/db/backends/postgresql/introspection.py
+++ b/django/db/backends/postgresql/introspection.py
@@ -206,7 +206,9 @@ class DatabaseIntrospection(BaseDatabaseIntrospection):
cl.reloptions
FROM pg_constraint AS c
JOIN pg_class AS cl ON c.conrelid = cl.oid
- WHERE cl.relname = %s AND pg_catalog.pg_table_is_visible(cl.oid)
+ WHERE cl.relname = %s
+ AND pg_catalog.pg_table_is_visible(cl.oid)
+ AND c.contype != 'n'
""",
[table_name],
)
|