Skip to content

Commit 83fd61d

Browse files
committed
Fix(postgres): Fix a bug in PostgresConnection.columnsFromSchema
PostgreSQL 12 removed outdated catalog attribute `pg_catalog.pg_attrdef.adsrc`.
1 parent cdf61fa commit 83fd61d

2 files changed

Lines changed: 6 additions & 1 deletion

File tree

docs/News.rst

Lines changed: 4 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -25,6 +25,10 @@ Bug fixes
2525

2626
* Fixed a bug in cascade deletion/nullification.
2727

28+
* Fixed a bug in ``PostgresConnection.columnsFromSchema``:
29+
PostgreSQL 12 removed outdated catalog attribute
30+
``pg_catalog.pg_attrdef.adsrc``.
31+
2832
* Fixed a bug working with microseconds in Time columns.
2933

3034
CI

sqlobject/postgres/pgconnection.py

Lines changed: 2 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -353,7 +353,8 @@ def columnsFromSchema(self, tableName, soClass):
353353
colQuery = """
354354
SELECT a.attname,
355355
pg_catalog.format_type(a.atttypid, a.atttypmod), a.attnotnull,
356-
(SELECT substring(d.adsrc for 128) FROM pg_catalog.pg_attrdef d
356+
(SELECT substring(pg_catalog.pg_get_expr(d.adbin, d.adrelid) for 128)
357+
FROM pg_catalog.pg_attrdef d
357358
WHERE d.adrelid=a.attrelid AND d.adnum = a.attnum)
358359
FROM pg_catalog.pg_attribute a
359360
WHERE a.attrelid =%s::regclass

0 commit comments

Comments
 (0)