Page MenuHomePhabricator

column "pr_pagetype" does not exist
Closed, ResolvedPublic


Author: mathias.behrle

Running a fresh install of 1.10A (SVN) on PostgreSQL I get the following error.
Creating the column with type text works for me, so I am assuming this is caused
by a liitle bit outdated table definition. Nevertheless I didn't find neither
the definition in /mysql5/tables.sql, so it seems to be a fault in all definitions.

A database error has occurred Query: DELETE FROM page_restrictions WHERE
(pr_pagetype=NULL) Function: Article::updateRestrictions Error: 1 ERROR: column
"pr_pagetype" does not exist


#0 /var/www/phase3/includes/Database.php(672):
DatabasePostgres->reportQueryError('ERROR: column ...', 1, 'DELETE FROM
pag...', 'Article::update...', false)
#1 /var/www/phase3/includes/DatabasePostgres.php(612): Database->query('DELETE
FROM pag...', 'Article::update...')
#2 /var/www/phase3/includes/Article.php(1716):
DatabasePostgres->replace('page_restrictio...', Array, Array,
'Article::update...') #3 /var/www/phase3/includes/ProtectionForm.php(169):
Article->updateRestrictions(Array, '', false, 'infinity')
#4 /var/www/phase3/includes/ProtectionForm.php(79): ProtectionForm->save()
#5 /var/www/phase3/includes/Article.php(1637): ProtectionForm->execute()
#6 /var/www/phase3/includes/Wiki.php(376): Article->protect()
#7 /var/www/phase3/includes/Wiki.php(48):
MediaWiki->performAction(Object(StubObject), Object(Article), Object(Title),
Object(User), Object(WebRequest)) #8 /var/www/phase3/index.php(48):
MediaWiki->initialize(Object(Title), Object(StubObject), Object(User),
Object(WebRequest)) #9 {main}

Version: unspecified
Severity: normal
OS: Linux
Platform: PC



Related Objects

View Standalone Graph
This task is connected to more than 200 other tasks. Only direct parents and subtasks are shown here. Use View Standalone Graph to show more of the graph.
Resolved werdna

Event Timeline

bzimport raised the priority of this task from to Medium.Nov 21 2014, 9:39 PM
bzimport set Reference to bz9097.

Reassigning to werdna: looks like r19095 introduced the column to Article.php
but not to the schema.

pr_pagetype is an unnamed key, so it basically acts as a contraint, however, in
article.php its being used as an index, which seems to confuse PostgreSQL.

To be more clear, I mean to say that line:

PRIMARY KEY (pr_page,pr_type)

Should probably be:

PRIMARY KEY pr_pagetype (pr_page,pr_type)

I've named the keys for clearity and added a unique index pr_pagetype for postgres.

mathias.behrle wrote:

Since pr_pagetype appears in the WHERE clause, defining as an index cannot be
the final solution. It should be a real column or not appear at all in the WHERE

river wrote:

fixed in r20216. the problem was that the uniqueindexes parameter to replace() is meant to contain an array of the column names that are considered
unique in the replace operation, not the index used to determine uniqueness.

mathias.behrle wrote:

Sorry for insisting once again:
the SQL error is gone, but on updating table page_restrictions (inserting a new
record) all old records are deleted

river wrote:

please try r20218, that should contain a working fix.

mathias.behrle wrote:

yes, now it works! Thanks a lot!

Jdforrester-WMF subscribed.

Migrating from the old tracking task to a tag for PostgreSQL-related tasks.