Page MenuHomePhabricator

RecentChanges and RecentChangesLinked broken for SQLite
Closed, ResolvedPublic

Description

SQL error from within function "SpecialRecentChanges::doMainQuery". SQLite returned error "1: near "(": syntax error".

Query:

(SELECT * FROM recentchanges LEFT JOIN watchlist ON ((wl_user=2 AND wl_title=rc_title AND wl_namespace=rc_namespace)) LEFT JOIN page ON ((rc_cur_id=page_id)) LEFT JOIN tag_summary ON ((ts_rc_id=rc_id)) WHERE rc_new = '1' AND (rc_timestamp >= '20090808000000') AND rc_bot = '0' ORDER BY rc_timestamp DESC LIMIT 50 ) UNION (SELECT * FROM recentchanges LEFT JOIN watchlist ON ((wl_user=2 AND wl_title=rc_title AND wl_namespace=rc_namespace)) LEFT JOIN page ON ((rc_cur_id=page_id)) LEFT JOIN tag_summary ON ((ts_rc_id=rc_id)) WHERE rc_new = '0' AND (rc_timestamp >= '20090808000000') AND rc_bot = '0' ORDER BY rc_timestamp DESC LIMIT 50 ) ORDER BY rc_timestamp DESC LIMIT 50


Version: 1.16.x
Severity: major
OS: Windows XP
Platform: PC

Details

Reference
bz20256

Event Timeline

bzimport raised the priority of this task from to Medium.Nov 21 2014, 10:50 PM
bzimport set Reference to bz20256.
bzimport added a subscriber: Unknown Object (MLST).

Probably it just can't handle () UNION ():

sqlite> select 1 as foo union select 2 as foo;
1
2
sqlite> (select 1 as foo) union (select 2 as foo);
SQL error: near "(": syntax error

Created attachment 6532
Proposed patch

Attached: