r81067 MediaWiki - Code Review archive

Repository:MediaWiki
Revision:r81066‎ | r81067 | r81068 >
Date:23:13, 26 January 2011
Author:reedy
Status:resolved (Comments)
Tags:
Comment:
Fixup query fail from r80936
Modified paths:
  • /trunk/phase3/includes/OutputPage.php (modified) (history)
  • /trunk/phase3/includes/Title.php (modified) (history)

Diff [purge]

Index: trunk/phase3/includes/OutputPage.php
@@ -1001,7 +1001,8 @@
10021002 array( 'page_id', 'page_namespace', 'page_title', 'page_len', 'page_is_redirect', 'page_latest', 'pp_value' ),
10031003 $lb->constructSet( 'page', $dbr ),
10041004 __METHOD__,
1005 - array( 'LEFT JOIN' => array( "pp_propname='hiddencat'", "pp_page=page_id" ) )
 1005+ array(),
 1006+ array( 'page_props' => array( 'LEFT JOIN' => array( "pp_propname='hiddencat'", "pp_page=page_id" ) ) )
10061007 );
10071008
10081009 # Add the results to the link cache
Index: trunk/phase3/includes/Title.php
@@ -3570,7 +3570,6 @@
35713571 return $stack;
35723572 }
35733573
3574 -
35753574 /**
35763575 * Get an associative array for selecting this title from
35773576 * the "page" table

Follow-up revisions

RevisionCommit summaryAuthorDate
r81100Followup r81067, use the right syntax for doing a joinoverlordq20:25, 27 January 2011

Past revisions this follows-up on

RevisionCommit summaryAuthorDate
r80936Couple more raw SQL to query arraysreedy23:15, 24 January 2011

Comments

#Comment by Nikerabbit (talk | contribs)   09:07, 27 January 2011
[27-Jan-2011 08:46:35] PHP Notice:  Undefined offset:  0 in /www/w/includes/db/Database.php on line 1674
[27-Jan-2011 08:46:35] PHP Notice:  Undefined offset:  1 in /www/w/includes/db/Database.php on line 1675
[27-Jan-2011 08:46:35] /wiki/Project_list/tt-cyrl: DB error: A database error has occurred.  Did you forget to run maintenance/update.php after upgrading?  See: [http://www.mediawiki.org/wiki/Manual:Upgrading#Run_the_update_script http://www.mediawiki.org/wiki/Manual:Upgrading#Run_the_update_script]
Query: SELECT  page_id,page_namespace,page_title,page_len,page_is_redirect,page_latest,pp_value  FROM `bw_page`  `bw_page_props`  WHERE (page_namespace = '14' AND page_title = 'Supported_projects')  
Function: OutputPage::addCategoryLinks
Error: 1054 Unknown column 'pp_value' in 'field list' (localhost)

I think we found what broke categories in twn. I'm marking this as FIXME as I don't want to start guessing which previous revision is the actual cause.

#Comment by Reedy (talk | contribs)   09:22, 27 January 2011

The query isn't left joining the page_props table, so hence getting this error

No access to a pc till much later on today...

#Comment by Krinkle (talk | contribs)   14:14, 27 January 2011

There's a missing comma after FROM '(prefix_)_page'

#Comment by Reedy (talk | contribs)   15:51, 27 January 2011

It's some subtle syntax error...

But that's not the cause, its ignoring the left join still

#Comment by Krinkle (talk | contribs)   16:21, 27 January 2011

Are you sure ? As far as I know a query like this: "SELECT .. FROM table1 table2 WHERE ..." (without a comma between table1 and table2) doesn't touch table2 at all – the "table2" part is ignored. To join, either an actual JOIN is needed or a comma in the FROM clause.

#Comment by Reedy (talk | contribs)   20:47, 27 January 2011

See the fix in r81100

Syntax error! :)

#Comment by Catrope (talk | contribs)   23:40, 27 January 2011

SELECT ... FROM table1 table2 really means FROM table1 AS table2

#Comment by Reedy (talk | contribs)   23:45, 27 January 2011

As below - "From memory tablename text would alias the table. With the quotes I'm not sure" ;)

#Comment by Reedy (talk | contribs)   16:47, 27 January 2011

Yes, the query isn't being correctly for some reason. But its completely ignoring the left join thats in the call.

No idea why its not doing it.

It's a symptom, not the cause.

Hence suggesting its a syntax error in the call.

From memory tablename text would alias the table. With the quotes I'm not sure

As I said, the left join is being ignored, and not built into the query, meaning the table, and hence the col missing giving the error that's reported

Status & tagging log