Skip to content

Commit 139ae20

Browse files
committed
chore(e2e): reconcile the published PostgreSQL guard correction
Use the equivalent guard already published and validated on the guide branch, preserving concurrent work while updating the harness stack. Refs #1540
2 parents cf7a547 + c549782 commit 139ae20

1 file changed

Lines changed: 4 additions & 5 deletions

File tree

‎e2e/migration-guide/postgres.ts‎

Lines changed: 4 additions & 5 deletions
Original file line numberDiff line numberDiff line change
@@ -142,14 +142,13 @@ export async function createExample(sql: postgres.Sql, table: string) {
142142
tx: postgres.TransactionSql,
143143
allowTargetIndexes: boolean,
144144
) {
145-
// PostgreSQL 18 records NOT NULL constraints in pg_constraint, including the
146-
// primary key's implicit one. Permit only that first-column obligation;
147-
// pg_attribute also catches customer NOT NULL declarations on PostgreSQL 17.
148-
// Source NOT NULL breaks target-only writes; target NOT NULL must survive rollback.
149145
const dependencies = await tx`SELECT
150146
EXISTS (SELECT 1 FROM pg_trigger WHERE tgrelid = ${table}::regclass AND NOT tgisinternal)
151147
OR EXISTS (SELECT 1 FROM pg_constraint WHERE (conrelid = ${table}::regclass OR confrelid = ${table}::regclass)
152-
AND NOT (conrelid = ${table}::regclass AND contype IN ('p', 'n') AND conkey = ARRAY[1]::smallint[]))
148+
-- PostgreSQL 18 also lists the primary key column's NOT NULL here.
149+
AND NOT (contype IN ('p', 'n') AND conrelid = ${table}::regclass AND conkey = ARRAY[1]::smallint[]))
150+
-- PostgreSQL 17 and earlier keep NOT NULL out of pg_constraint, so read
151+
-- it from the column on every version.
153152
OR EXISTS (SELECT 1 FROM pg_attribute WHERE attrelid = ${table}::regclass
154153
AND attnum > 1 AND NOT attisdropped AND attnotnull)
155154
OR EXISTS (SELECT 1 FROM pg_index ix JOIN pg_class idx ON idx.oid = ix.indexrelid

0 commit comments

Comments
 (0)