dd_constraints.v2.patch
text/x-patch
Filename: dd_constraints.v2.patch
Type: text/x-patch
Part: 0
Patch
Same data as JSON:
GET /api/v1/attachments/:id/patch
the parsed metadata as JSON — format, series position, per-file stats; never the diff bytes.
API reference →
Format: unified
Series: patch v2
| File | + | − |
|---|---|---|
| doc/src/sgml/ref/psql-ref.sgml | 0 | 0 |
| src/bin/psql/describe.c | 0 | 0 |
diff --git a/doc/src/sgml/ref/psql-ref.sgml b/doc/src/sgml/ref/psql-ref.sgml
index ac351d3..20dfd1d 100644
*** a/doc/src/sgml/ref/psql-ref.sgml
--- b/doc/src/sgml/ref/psql-ref.sgml
*************** testdb=>
*** 991,997 ****
objects.
<quote>Object</quote> covers aggregates, functions, operators,
types, relations (tables, views, indexes, sequences), large
! objects, rules, and triggers. For example:
<programlisting>
=> <userinput>\dd version</userinput>
Object descriptions
--- 991,997 ----
objects.
<quote>Object</quote> covers aggregates, functions, operators,
types, relations (tables, views, indexes, sequences), large
! objects, rules, triggers, and constraints. For example:
<programlisting>
=> <userinput>\dd version</userinput>
Object descriptions
diff --git a/src/bin/psql/describe.c b/src/bin/psql/describe.c
index e01fb7b..6da97e7 100644
*** a/src/bin/psql/describe.c
--- b/src/bin/psql/describe.c
*************** objectDescription(const char *pattern, b
*** 998,1003 ****
--- 998,1026 ----
"n.nspname", "t.tgname", NULL,
"pg_catalog.pg_table_is_visible(c.oid)");
+ /* Constraint descriptions */
+ appendPQExpBuffer(&buf,
+ "UNION ALL\n"
+ " SELECT pgc.oid as oid, pgc.tableoid AS tableoid,\n"
+ " n.nspname as nspname,\n"
+ " CAST(pgc.conname AS pg_catalog.text) as name,"
+ " CAST('%s' AS pg_catalog.text) as object\n"
+ " FROM pg_catalog.pg_constraint pgc\n"
+ " JOIN pg_catalog.pg_class c "
+ "ON c.oid = pgc.conrelid\n"
+ " LEFT JOIN pg_catalog.pg_namespace n "
+ " ON n.oid = c.relnamespace\n",
+ gettext_noop("constraint"));
+
+ if (!showSystem && !pattern)
+ appendPQExpBuffer(&buf, "WHERE n.nspname <> 'pg_catalog'\n"
+ " AND n.nspname <> 'information_schema'\n");
+
+ /* XXX not sure what to do about visibility rule here? */
+ processSQLNamePattern(pset.db, &buf, pattern, !showSystem && !pattern, false,
+ "n.nspname", "pgc.conname", NULL,
+ "pg_catalog.pg_table_is_visible(c.oid)");
+
appendPQExpBuffer(&buf,
") AS tt\n"
" JOIN pg_catalog.pg_description d ON (tt.oid = d.objoid AND tt.tableoid = d.classoid AND d.objsubid = 0)\n");