Forking from https://bugs.launchpad.net/ubuntu/+source/mediawiki/+bug/1852408
Error: 42703 ERROR: column "adsrc" does not exist
Example fail at:
https://objectstorage.prodstack4-5.canonical.com/v1/AUTH_77e2ada1e7a84929a74ba3b87153c0ac/autopkgtest-focal/focal/amd64/m/mediawiki/20191110_233944_a0b04@/log.gz
Test fails at this step:
php /var/lib/mediawiki/maintenance/update.php --conf /tmp/mw-install/LocalSettings.php --quick
Enabling debug like recommended by the error:
Set $wgShowExceptionDetails = true; and $wgShowDBErrorBacktrace = true; at the bottom of LocalSettings.php to show detailed debugging information.
[5cd5bda7f0c1e41c4cf40a4c] [no req] Wikimedia\Rdbms\DBQueryError from line 1457 of /usr/share/mediawiki/includes/libs/rdbms/database/Database.php: A database query error has occurred. Did you forget to run your application's database schema updater after upgrading?
Query: SELECT
attnotnull, attlen, conname AS conname,
atthasdef,
adsrc,
COALESCE(condeferred, 'f') AS deferred,
COALESCE(condeferrable, 'f') AS deferrable,
CASE WHEN typname = 'int2' THEN 'smallint'
WHEN typname = 'int4' THEN 'integer'
WHEN typname = 'int8' THEN 'bigint'
WHEN typname = 'bpchar' THEN 'char'
ELSE typname END AS typname
FROM pg_class c
JOIN pg_namespace n ON (n.oid = c.relnamespace)
JOIN pg_attribute a ON (a.attrelid = c.oid)
JOIN pg_type t ON (t.oid = a.atttypid)
LEFT JOIN pg_constraint o ON (o.conrelid = c.oid AND a.attnum = ANY(o.conkey) AND o.contype = 'f')
LEFT JOIN pg_attrdef d on c.oid=d.adrelid and a.attnum=d.adnum
WHERE relkind = 'r'
AND nspname='mediawiki'
AND relname='updatelog'
AND attname='ul_value';
Function: Wikimedia\Rdbms\Database::query
Error: 42703 ERROR: column "adsrc" does not exist
LINE 3: adsrc,
^
Backtrace:
#0 /usr/share/mediawiki/includes/libs/rdbms/database/Database.php(1427): Wikimedia\Rdbms\Database->makeQueryException(string, string, string, string)
#1 /usr/share/mediawiki/includes/libs/rdbms/database/Database.php(1200): Wikimedia\Rdbms\Database->reportQueryError(string, string, string, string, boolean)
#2 /usr/share/mediawiki/includes/libs/rdbms/field/PostgresField.php(46): Wikimedia\Rdbms\Database->query(string)
#3 /usr/share/mediawiki/includes/libs/rdbms/database/DatabasePostgres.php(1244): Wikimedia\Rdbms\PostgresField::fromText(Wikimedia\Rdbms\DatabasePostgres, string, string)
#4 /usr/share/mediawiki/includes/installer/PostgresUpdater.php(839): Wikimedia\Rdbms\DatabasePostgres->fieldInfo(string, string)
#5 /usr/share/mediawiki/includes/installer/DatabaseUpdater.php(482): PostgresUpdater->addPgField(string, string, string)
#6 /usr/share/mediawiki/includes/installer/DatabaseUpdater.php(446): DatabaseUpdater->runUpdates(array, boolean)
#7 /usr/share/mediawiki/maintenance/update.php(203): DatabaseUpdater->doUpdates(array)
#8 /usr/share/mediawiki/maintenance/doMaintenance.php(94): UpdateMediaWiki->execute()
#9 /usr/share/mediawiki/maintenance/update.php(248): require_once(string)
#10 {main}
No immediate bugs found with that signature.
Checking how the table actually looks like:
Those have only read access to adsrc:
/var/lib/mediawiki/maintenance/dictionary/mediawiki.dic
/var/lib/mediawiki/includes/libs/rdbms/field/PostgresField.php
/var/lib/mediawiki/includes/libs/rdbms/database/DatabasePostgres.php
Nothing else in the source unless the .dic will auto-create it.
Maybe it is a default entry ...
=> https://www.postgresql.org/docs/11/catalog-pg-attrdef.html
This was deprcated even in V8 of postgresql
Part of pg_attrdef:
The adsrc field is historical, and is best not used, because it does not track outside changes that might affect the representation of the default value. Reverse-compiling the adbin field (with pg_get_expr for example) is a better way to display the default value.
With that known lets look for fixes ...
2e5d114a99cf162074f92fc390590da44084362d rdbms: Use correct value for 'sslmode' in DatabasePostgres
27d342ef4bd31da48b0e10655daf1320e3d00b50 rdbms: Remove references to pg_attrdef.adsrc in Postgres code
Both are in mediawiki since 1.33, but those are not on the REL1_31 stable branch.
Since we have a sync right now lets take a look at backporting these.
https://github.com/wikimedia/mediawiki/commit/27d342ef4bd31da48b0e10655daf1320e3d00b50
https://github.com/wikimedia/mediawiki/commit/2e5d114a99cf162074f92fc390590da44084362d
But this isn't in git ubuntu and the Debian VCS link points to an upstrema hosted outdated repository.
It misses the last two uploads.
This is empty:
$ git grep "1.31.5-1" $(git rev-list --all)The fix suggested upstream is:
Since we have a sync right now lets take a look at backporting these.
https://github.com/wikimedia/mediawiki/commit/27d342ef4bd31da48b0e10655daf1320e3d00b50
https://github.com/wikimedia/mediawiki/commit/2e5d114a99cf162074f92fc390590da44084362d
Going to backport these to 1.31 and 1.32 as the fixes