Fix information schema for catalogued not-null constraints
authorPeter Eisentraut <peter@eisentraut.org>
Mon, 18 Sep 2023 06:10:51 +0000 (08:10 +0200)
committerPeter Eisentraut <peter@eisentraut.org>
Mon, 18 Sep 2023 06:10:51 +0000 (08:10 +0200)
The column check_constraints.check_clause should be like

    col IS NOT NULL

without a surrounding CHECK (...).

Discussion: https://www.postgresql.org/message-id/09489196-0bc1-e796-c43e-63425f7c5910@eisentraut.org

src/backend/catalog/information_schema.sql
src/include/catalog/catversion.h

index 8fc0fb4bcdb6f93d8f68fbcdacaaa9102c5d1587..7f7de91cc24c1e21b16ffd79ac278243a4fdf9dc 100644 (file)
@@ -449,7 +449,7 @@ CREATE VIEW check_constraints AS
     SELECT current_database()::information_schema.sql_identifier AS constraint_catalog,
            rs.nspname::information_schema.sql_identifier AS constraint_schema,
            con.conname::information_schema.sql_identifier AS constraint_name,
-           pg_catalog.format('CHECK (%s IS NOT NULL)', at.attname)::information_schema.character_data AS check_clause
+           pg_catalog.format('%s IS NOT NULL', at.attname)::information_schema.character_data AS check_clause
      FROM pg_constraint con
             LEFT JOIN pg_namespace rs ON rs.oid = con.connamespace
             LEFT JOIN pg_class c ON c.oid = con.conrelid
index 4eaef54d0ca4697204761fd318b107168dc2043f..8799f3f03a4c9f51ce29f0340839c4f69b20c4fc 100644 (file)
@@ -57,6 +57,6 @@
  */
 
 /*                         yyyymmddN */
-#define CATALOG_VERSION_NO 202309061
+#define CATALOG_VERSION_NO 202309181
 
 #endif