You signed in with another tab or window. Reload to refresh your session.You signed out in another tab or window. Reload to refresh your session.You switched accounts on another tab or window. Reload to refresh your session.Dismiss alert
* Improve `pg_get_constraintdef` UDF
`pg_get_constraintdef` can optionally take a boolean as a second
parameter, so update the UDF to support this.
* Implement `pg_partition_ancestors`
Add a UDF for `pg_partition_ancestors`
* Add tests for describe table in psql
Add test for describing an example table (`\d customer`) to ensure we
handle it properly. Most of the queries already worked fine (only 2
failed) but I added them all for completeness.
WHERE d.adrelid = a.attrelid AND d.adnum = a.attnum AND a.atthasdef),
124
+
a.attnotnull,
125
+
(SELECT c.collname FROM pg_catalog.pg_collation c, pg_catalog.pg_type t
126
+
WHERE c.oid = a.attcollation AND t.oid = a.atttypid AND a.attcollation <> t.typcollation) AS attcollation,
127
+
a.attidentity,
128
+
a.attgenerated
129
+
FROM pg_catalog.pg_attribute a
130
+
WHERE a.attrelid = '16417' AND a.attnum > 0 AND NOT a.attisdropped
131
+
ORDER BY a.attnum;"#,
132
+
133
+
134
+
r#"SELECT true as sametable, conname,
135
+
pg_catalog.pg_get_constraintdef(r.oid, true) as condef,
136
+
conrelid::pg_catalog.regclass AS ontable
137
+
FROM pg_catalog.pg_constraint r
138
+
WHERE r.conrelid = '16417' AND r.contype = 'f'
139
+
AND conparentid = 0
140
+
ORDER BY conname;"#,
141
+
142
+
r#"SELECT conname, conrelid::pg_catalog.regclass AS ontable,
143
+
pg_catalog.pg_get_constraintdef(oid, true) AS condef
144
+
FROM pg_catalog.pg_constraint c
145
+
WHERE confrelid IN (SELECT pg_catalog.pg_partition_ancestors('16417')
146
+
UNION ALL VALUES ('16417'::pg_catalog.regclass))
147
+
AND contype = 'f' AND conparentid = 0
148
+
ORDER BY conname;"#,
149
+
150
+
r#"SELECT pol.polname, pol.polpermissive,
151
+
CASE WHEN pol.polroles = '{0}' THEN NULL ELSE pg_catalog.array_to_string(array(select rolname from pg_catalog.pg_roles where oid = any (pol.polroles) order by 1),',') END,
0 commit comments