Reject legacy collation and persistence drift before adoption

This commit is contained in:
Artyom
2026-11-05 21:41:01 +03:00
parent 71c643c6d1
commit 66c614426c
2 changed files with 6 additions and 2 deletions
+4 -2
View File
@@ -17,12 +17,14 @@ SNAPSHOT = text("""
AND c.relname NOT IN ('schema_migrations', 'alembic_version')
)
SELECT 'table' AS kind, c.relname AS name,
concat_ws('|', c.relkind, c.relrowsecurity, c.relforcerowsecurity) AS definition
concat_ws('|', c.relkind, c.relpersistence,
c.relrowsecurity, c.relforcerowsecurity) AS definition
FROM relations c
UNION ALL
SELECT 'column', c.relname || '.' || a.attname,
concat_ws('|', a.attnum, format_type(a.atttypid, a.atttypmod), a.attnotnull,
a.attidentity, a.attgenerated, pg_get_expr(d.adbin, d.adrelid))
a.attidentity, a.attgenerated, a.attcollation::regcollation,
pg_get_expr(d.adbin, d.adrelid))
FROM relations c JOIN pg_attribute a ON a.attrelid = c.oid
LEFT JOIN pg_attrdef d ON d.adrelid = c.oid AND d.adnum = a.attnum
WHERE a.attnum > 0 AND NOT a.attisdropped