Page MenuHomePhabricator

PostgresUpdater sets watchlist wl_namespace to 0 and is therefore causing duplicated key error
Closed, DuplicatePublicBUG REPORT

Description

List of steps to reproduce (step by step, including full links if applicable):

  • A) set up mediawiki (1.36.1) using postgres database (tested with 12.7)
  • B) let a user watch a page
  • this leads typically to 2 entries in the table 'watchlist' which differ only in the wl_namespace (one for 'talk' and one for e.g. 'main')
  • C) run the upgrade under /mw-config

What happens?:
The upgrade fails because in PostgresUpdater.php the line

[ 'changeField', 'watchlist', 'wl_namespace', 'INT', 0 ]

will lead the updater to set all namespaces in watchlist to 0.
That alone is questionable. However the crash happens because now there is a unique index violation for the
index wl_user (wl_user, wl_namespace, wl_title).

What should have happened instead?:
I think the line should be:

[ 'changeField', 'watchlist', 'wl_namespace', 'INT', '' ]

Software version (if not a Wikimedia wiki), browser information, screenshots, other information, etc:
mediawiki: 1.36.1