aboutsummaryrefslogtreecommitdiff
path: root/src
diff options
context:
space:
mode:
authorPeter Eisentraut <peter@eisentraut.org>2023-09-22 07:40:56 +0200
committerPeter Eisentraut <peter@eisentraut.org>2023-09-22 07:43:26 +0200
commite59fcbd712c777eb2987d7c9ad542a7e817954ec (patch)
tree3659fbba928f29af54e76ee8041f0473d2bf7282 /src
parent48e2b234f822ea1610826be4526bb56ca4734dbe (diff)
downloadpostgresql-e59fcbd712c777eb2987d7c9ad542a7e817954ec.tar.gz
postgresql-e59fcbd712c777eb2987d7c9ad542a7e817954ec.zip
Simplify information schema check constraint deparsing
The computation of the column information_schema.check_constraints.check_clause used pg_get_constraintdef() plus some string manipulation to get the check clause back out. This ended up with an extra pair of parentheses, which is only an aesthetic problem, but also with suffixes like "NOT VALID", which don't belong into that column. We can fix both of these problems and simplify the code by just using pg_get_expr() instead. Discussion: https://www.postgresql.org/message-id/799b59ef-3330-f0d2-ee23-8cdfa1740987@eisentraut.org
Diffstat (limited to 'src')
-rw-r--r--src/backend/catalog/information_schema.sql3
-rw-r--r--src/include/catalog/catversion.h2
2 files changed, 2 insertions, 3 deletions
diff --git a/src/backend/catalog/information_schema.sql b/src/backend/catalog/information_schema.sql
index 7f7de91cc24..10b34c3c5b8 100644
--- a/src/backend/catalog/information_schema.sql
+++ b/src/backend/catalog/information_schema.sql
@@ -435,8 +435,7 @@ CREATE VIEW check_constraints AS
SELECT CAST(current_database() AS sql_identifier) AS constraint_catalog,
CAST(rs.nspname AS sql_identifier) AS constraint_schema,
CAST(con.conname AS sql_identifier) AS constraint_name,
- CAST(substring(pg_get_constraintdef(con.oid) from 7) AS character_data)
- AS check_clause
+ CAST(pg_get_expr(con.conbin, coalesce(c.oid, 0)) AS character_data) AS check_clause
FROM pg_constraint con
LEFT OUTER JOIN pg_namespace rs ON (rs.oid = con.connamespace)
LEFT OUTER JOIN pg_class c ON (c.oid = con.conrelid)
diff --git a/src/include/catalog/catversion.h b/src/include/catalog/catversion.h
index 8799f3f03a4..48be6d13701 100644
--- a/src/include/catalog/catversion.h
+++ b/src/include/catalog/catversion.h
@@ -57,6 +57,6 @@
*/
/* yyyymmddN */
-#define CATALOG_VERSION_NO 202309181
+#define CATALOG_VERSION_NO 202309221
#endif