Problem/Motivation
While testing the new 7.x-dev release I have run into an issue on one website running on PostgreSQL 12. The problem is with this patch: #2823488: Backport DatabaseSchema_pgsql::queryTableInformation() improvements (originally backported 6 years ago by @mradcliffe). After this patch there seems to be an error on PostgreSQL 12:
PDOException: SQLSTATE[42703]: Undefined column: 7 ERROR: column pg_attrdef.adsrc does not exist LINE 8: OR pg_attrdef.adsrc::text LIKE 'nextval%') ^: SELECT pg_attribute.attname AS column_name, format_type(pg_attribute.atttypid, pg_attribute.atttypmod) AS data_type, pg_get_expr(pg_attrdef.adbin, pg_attribute.attrelid) AS column_default FROM pg_attribute LEFT JOIN pg_attrdef ON pg_attrdef.adrelid = pg_attribute.attrelid AND pg_attrdef.adnum = pg_attribute.attnum WHERE pg_attribute.attnum > 0 AND NOT pg_attribute.attisdropped AND pg_attribute.attrelid = :key::regclass AND (format_type(pg_attribute.atttypid, pg_attribute.atttypmod) = 'bytea' OR pg_attrdef.adsrc LIKE 'nextval%'); Array ( [:key] => public.variable ) in variable_set()
The backport was correct but Drupal 8/9 had an additional patch following the original one, which fixed an issue with PostgreSQL 12 and newer.
The table column pg_attrdef.adsrc has been removed by PostgreSQL in version 12. See: https://www.postgresql.org/docs/current/catalog-pg-attrdef.html
Unfortunately this was not revealed with automated testing because PostgreSQL 12 is not set as the main version to test. The original D8 issue with the patch is here: #3058853: Drupal 8.x on Postgresql 12.
Steps to reproduce
Proposed resolution
Remaining tasks
User interface changes
API changes
Data model changes
Release notes snippet
Comments
Comment #2
poker10 commentedBackport of the patch for D7 is attached.
Comment #13
mcdruid commentedAdding credit from the original issue (which I often forget - sorry) + Fabianx who has reviewed this.
Comment #15
mcdruid commentedThanks for getting this in to the 7.90 release (due tomorrow) and avoiding a hotfix firedrill!