Last modified: 2012-08-04 20:48:53 UTC

Wikimedia Bugzilla is closed!

Wikimedia migrated from Bugzilla to Phabricator. Bug reports are handled in Wikimedia Phabricator.
This static website is read-only and for historical purposes. It is not possible to log in and except for displaying bug reports and their history, links might be broken. See T14714, the corresponding Phabricator task for complete and up-to-date bug report information.
Bug 12714 - CheckUser installation has invalid SQL for Postgres
CheckUser installation has invalid SQL for Postgres
Status: RESOLVED FIXED
Product: MediaWiki extensions
Classification: Unclassified
CheckUser (Other open bugs)
unspecified
All All
: Normal major (vote)
: ---
Assigned To: Nobody - You can work on this!
:
Depends on:
Blocks: postgres
  Show dependency treegraph
 
Reported: 2008-01-20 19:43 UTC by OverlordQ
Modified: 2012-08-04 20:48 UTC (History)
1 user (show)

See Also:
Web browser: ---
Mobile Platform: ---
Assignee Huggle Beta Tester: ---


Attachments
Patch for invalid psql syntax (982 bytes, patch)
2008-01-20 20:04 UTC, OverlordQ
Details

Description OverlordQ 2008-01-20 19:43:08 UTC
When running the update script it throws this error:

====
MediaWiki 1.12alpha Updater

Going to run database updates for wikidb
Depending on the size of your database this may take a while!
Abort with control-c in the next five seconds...0
...cu_changes already exists.
Warning: pg_query(): Query failed: ERROR:  syntax error at or near ")"
LINE 13:  )
          ^ in /home/wiki/includes/DatabasePostgres.php on line 542
...cu_log added
...log file missing, skipping log import.
Warning: pg_query(): Query failed: ERROR:  current transaction is aborted, commands ignored until end of transaction block in /home/wiki/includes/DatabasePostgres.php on line 542
Warning: pg_fetch_result(): supplied argument is not a valid PostgreSQL result resource in /home/wiki/maintenance/updaters.inc on line 1273
Notice: Undefined offset:  1 in /home/wiki/maintenance/updaters.inc on line 1276
Adding in schema "mediawiki" to search_path for user "wikiuser"
Adding in schema "public" to search_path for user "wikiuser"
Warning: pg_query(): Query failed: ERROR:  current transaction is aborted, commands ignored until end of transaction block in /home/wiki/includes/DatabasePostgres.php on line 542
Warning: pg_query(): Query failed: ERROR:  current transaction is aborted, commands ignored until end of transaction block in /home/wiki/includes/DatabasePostgres.php on line 542
Setting client_min_messages to 'error' for user "wikiuser"
Warning: pg_query(): Query failed: ERROR:  current transaction is aborted, commands ignored until end of transaction block in /home/wiki/includes/DatabasePostgres.php on line 542
Warning: pg_query(): Query failed: ERROR:  current transaction is aborted, commands ignored until end of transaction block in /home/wiki/includes/DatabasePostgres.php on line 542
Setting DateStyle to 'ISO, YMD' for user "wikiuser"
Warning: pg_query(): Query failed: ERROR:  current transaction is aborted, commands ignored until end of transaction block in /home/wiki/includes/DatabasePostgres.php on line 542
Warning: pg_query(): Query failed: ERROR:  current transaction is aborted, commands ignored until end of transaction block in /home/wiki/includes/DatabasePostgres.php on line 542
Setting TimeZone to 'GMT' for user "wikiuser"
Warning: pg_query(): Query failed: ERROR:  current transaction is aborted, commands ignored until end of transaction block in /home/wiki/includes/DatabasePostgres.php on line 542
Warning: pg_query(): Query failed: ERROR:  current transaction is aborted, commands ignored until end of transaction block in /home/wiki/includes/DatabasePostgres.php on line 542
Warning: pg_query(): Query failed: ERROR:  current transaction is aborted, commands ignored until end of transaction block in /home/wiki/includes/DatabasePostgres.php on line 542
A database error has occurred
Query: SELECT 1 FROM pg_catalog.pg_class c, pg_catalog.pg_namespace n WHERE c.relnamespace = n.oid AND c.relname = 'log_log_id_seq' AND n.nspname = 'mediawiki' AND c.relkind IN ('S')
Function:
Error: 1 ERROR:  current transaction is aborted, commands ignored until end of transaction block

Backtrace:
#0 /home/wiki/includes/Database.php(799): DatabasePostgres->reportQueryError('ERROR:  current...', 1, 'SELECT 1 FROM p...', '', false)
#1 /home/wiki/includes/DatabasePostgres.php(1003): Database->query('SELECT 1 FROM p...')
#2 /home/wiki/includes/DatabasePostgres.php(1019): DatabasePostgres->relationExists('log_log_id_seq', 'S', false)
#3 /home/wiki/maintenance/updaters.inc(1408): DatabasePostgres->sequenceExists('log_log_id_seq')
#4 /home/wiki/maintenance/updaters.inc(944): do_postgres_updates()
#5 /home/wiki/maintenance/update.php(59): do_all_updates(false, true)
#6 {main}
===
Comment 1 OverlordQ 2008-01-20 19:58:58 UTC
After liberally adding some debug statements I believe I traced the problem statement to here:

===
SQL : CREATE /* Database::sourceStream  */ SEQUENCE cu_log_cul_id_seq

SQL : CREATE /* Database::sourceStream  */ TABLE cu_log (
 cul_id           INTEGER  NOT NULL DEFAULT nextval('cu_log_cul_id_seq'),
 cul_timestamp    TIMESTAMPTZ,
 cul_user         INTEGER      NULL REFERENCES mwuser(user_id) ON DELETE SET NULL,
 cul_user_text    TEXT     NOT NULL,
 cul_reason       TEXT     NOT NULL DEFAULT '',
 cul_type         TEXT     NOT NULL DEFAULT '',
 cul_target_id    INTEGER      NULL REFERENCES mwuser(user_id) ON DELETE SET NULL,
 cul_target_text  TEXT     NOT NULL DEFAULT '',
 cul_target_hex   TEXT     NOT NULL DEFAULT '',
 cul_range_start  TEXT     NOT NULL DEFAULT '',
 cul_range_end    TEXT     NOT NULL DEFAULT '',
 )

Warning: pg_query(): Query failed: ERROR:  syntax error at or near ")"
LINE 13:  )
          ^ in /home/wiki/includes/DatabasePostgres.php on line 543
===

As such, I believe this is a bug in the CheckUser extension rather then the DB.
Comment 2 OverlordQ 2008-01-20 20:04:40 UTC
Created attachment 4564 [details]
Patch for invalid psql syntax
Comment 3 OverlordQ 2008-01-20 20:05:10 UTC
After fixing that line, the following CREATE INDEX lines caused errors as well.
Comment 4 Aaron Schulz 2008-01-21 19:39:27 UTC
(In reply to comment #3)
> After fixing that line, the following CREATE INDEX lines caused errors as well.
> 

As of the query on SVN now, what errors are given?
Comment 5 OverlordQ 2008-01-21 19:44:36 UTC
===
ERROR:  syntax error at or near ","
LINE 19: CREATE INDEX cul_user ON cu_log (cul_user),
===
Comment 6 Aaron Schulz 2008-01-21 19:49:56 UTC
(In reply to comment #5)
> ===
> ERROR:  syntax error at or near ","
> LINE 19: CREATE INDEX cul_user ON cu_log (cul_user),
> ===
> 

Bah, I thought I changed that already. Try r30032.
Comment 7 Aaron Schulz 2008-01-21 20:00:43 UTC
Done in r30032.

Note You need to log in before you can comment on or make changes to this bug.


Navigation
Links