Fix information schema for catalogued not-null constraints

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
This commit is contained in:
Peter Eisentraut 2023-09-18 08:10:51 +02:00
parent 9d17e5f16f
commit a0a5e0feb3
2 changed files with 2 additions and 2 deletions

View 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

View File

@ -57,6 +57,6 @@
*/
/* yyyymmddN */
#define CATALOG_VERSION_NO 202309061
#define CATALOG_VERSION_NO 202309181
#endif