Schema check: a unique key is matched by shape, not name; quiet fixture pools
The rule mutation that stopped checking a named unique index by its name survived, and rightly: an index of the same table, key columns, predicate, uniqueness and immediacy keeps R21.1 whatever it is called, and the named index's existence is already required as a relation. The name condition and REQUIRED_KEYS' index field are deleted. The live block failed 5 of 10 repeated runs with unhandled 57P01 errors: a test's own pool, already ended, still had connections closing when the forced drop terminated them, and nothing listened. Every pool the tests open now goes through fixturePool, which ignores those errors; the store's own pool keeps its listener and is not a fixture. Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com>
This commit is contained in:
parent
fd98e36186
commit
6c0c87669f
3 changed files with 29 additions and 26 deletions
|
|
@ -335,11 +335,10 @@ export class PostgresStore implements HeimdallStore {
|
|||
AND a.atttypid = to_regtype(required.type_name)
|
||||
)
|
||||
UNION ALL
|
||||
SELECT 'missing' FROM unnest($5::text[], $6::text[], $7::text[], $8::text[]) AS required(table_name, columns, index_name, predicate)
|
||||
SELECT 'missing' FROM unnest($5::text[], $6::text[], $7::text[]) AS required(table_name, columns, predicate)
|
||||
WHERE NOT EXISTS (
|
||||
SELECT 1 FROM pg_index i
|
||||
WHERE i.indrelid = to_regclass(required.table_name)
|
||||
AND (required.index_name = '' OR i.indexrelid = to_regclass(required.index_name))
|
||||
AND i.indisunique
|
||||
AND i.indimmediate
|
||||
AND coalesce(regexp_replace(lower(pg_get_expr(i.indpred, i.indrelid)), '[()[:space:]]', '', 'g'), '') = required.predicate
|
||||
|
|
@ -352,7 +351,7 @@ export class PostgresStore implements HeimdallStore {
|
|||
) = required.columns
|
||||
)
|
||||
UNION ALL
|
||||
SELECT 'privilege' FROM unnest($9::text[], $10::text[]) AS required(table_name, privilege)
|
||||
SELECT 'privilege' FROM unnest($8::text[], $9::text[]) AS required(table_name, privilege)
|
||||
WHERE to_regclass(required.table_name) IS NOT NULL
|
||||
AND NOT has_table_privilege(to_regclass(required.table_name), required.privilege)
|
||||
`,
|
||||
|
|
@ -363,7 +362,6 @@ export class PostgresStore implements HeimdallStore {
|
|||
REQUIRED_COLUMNS.map((required) => required.type),
|
||||
REQUIRED_KEYS.map((required) => required.table),
|
||||
REQUIRED_KEYS.map((required) => required.columns),
|
||||
REQUIRED_KEYS.map((required) => required.index),
|
||||
REQUIRED_KEYS.map((required) => required.predicate),
|
||||
privileges.map((required) => required.table),
|
||||
privileges.map((required) => required.privilege),
|
||||
|
|
|
|||
Loading…
Reference in a new issue