Page MenuHomePhabricator

CentralNotice doesn't work with Postgres: ERROR: relation "cn_notices" does not exist
Closed, ResolvedPublic

Description

I couldn't get CentralNotice to work, running update.php didn't populate the database tables.

I went looking in the code and found that CNDatabasePatcher.php has branches for MySQL and for SQLite, and returns true without doing anything on Postgres (or any other hypothetical backend that isn't MySQL or SQLite).

As of writing, affects both the version from https://www.mediawiki.org/wiki/Special:ExtensionDistributor/CentralNotice for 1.35 as well as the latest git master.

Steps to reproduce:

  1. Have a MediaWiki 1.35 instance with a Postgres database.
  2. Add CentralNotice to extensions
  3. Add to LocalSettings.php the snippet below
  4. Run maintenance/update.php. It should exit with no errors, but the output will make zero mention of cn_notices or other CentralNotice DB tables. I attached the output from running locally below.
  5. Visit Special:CentralNotice
  6. Observe database error

Database error:

 /w/Special:CentralNotice Wikimedia\Rdbms\DBQueryError from line 1699 of <install directory>/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?

Error 42P01: ERROR: relation "cn_notices" does not exist
LINE 1: ...p_notice_id = notices.not_id ) AS projects FROM "cn_notice...

LocalSettings.php:

$wgShowExceptionDetails = true;
$wgShowDBErrorBacktrace = true;
$wgShowSQLErrors = true;

wfLoadExtension( 'CentralNotice' );
$wgNoticeInfrastructure = true;
$wgNoticeProjects = [];

update.php output:

Event Timeline

Aklapper renamed this task from CentralNotice doesn't work with Postgres to CentralNotice doesn't work with Postgres: ERROR: relation "cn_notices" does not exist.Jan 1 2021, 8:41 PM

Add CentralNotice to extensions

Hi, which branch / revision?

Add CentralNotice to extensions

Hi, which branch / revision?

Latest master (as of writing) reproduced it locally, 80d0e769aa30bc502d43fd1b8c13043b2a5f6250.