Add fields to GROUP BY clauses in read_schema function (#255)

Specify all columns projected by the `SELECT` in the `GROUP BY` clauses
used by the `read_schema` function.
This commit is contained in:
Andrew Farries 2024-01-29 16:49:08 +00:00 committed by GitHub
parent 355ac20281
commit 9d25159638
No known key found for this signature in database
GPG Key ID: B5690EEEBB952194

View File

@ -180,7 +180,7 @@ BEGIN
FROM pg_index pi
JOIN pg_attribute a ON a.attrelid = pi.indrelid AND a.attnum = ANY(pi.indkey)
WHERE indrelid = t.oid::regclass
GROUP BY pi.indexrelid
GROUP BY pi.indexrelid, pi.indisunique
) as ix_details
),
'checkConstraints', (
@ -198,7 +198,7 @@ BEGIN
INNER JOIN pg_attribute cc_attr ON cc_attr.attrelid = cc_constraint.conrelid AND cc_attr.attnum = ANY(cc_constraint.conkey)
WHERE cc_constraint.conrelid = t.oid
AND cc_constraint.contype = 'c'
GROUP BY cc_constraint.oid
GROUP BY cc_constraint.oid, cc_constraint.conname
) AS cc_details
),
'uniqueConstraints', (
@ -215,7 +215,7 @@ BEGIN
INNER JOIN pg_attribute uc_attr ON uc_attr.attrelid = uc_constraint.conrelid AND uc_attr.attnum = ANY(uc_constraint.conkey)
WHERE uc_constraint.conrelid = t.oid
AND uc_constraint.contype = 'u'
GROUP BY uc_constraint.oid
GROUP BY uc_constraint.oid, uc_constraint.conname
) AS uc_details
),
'foreignKeys', (