Page MenuHomePhabricator

SELECT ... LIMIT fails on PostgreSQL
Closed, ResolvedPublic

Description

Author: hans.spaans

Description:
Rewrite LIMIT #,# to LIMIT # OFFSET #

The current SELECT statement fails on PostgreSQL since it doesn't support LIMIT #,#, but both MySQL and PostgreSQL do support LIMIT # OFFSET #. The patch attached should make the SELECT statement work with both MySQL and PostgreSQL.

http://dev.mysql.com/doc/refman/5.1/en/select.html
http://www.postgresql.org/docs/8.3/static/sql-select.html


Version: unspecified
Severity: minor

attachment mwe-newestpages-r50851-hspaans-1.patch ignored as obsolete

Details

Reference
bz18863

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.
StatusSubtypeAssignedTask
InvalidNone
ResolvedNone

Event Timeline

bzimport raised the priority of this task from to Medium.Nov 21 2014, 10:42 PM
bzimport set Reference to bz18863.

This should be using database abstraction functions -- in this case it should be possible to build the query more cleanly with Database::select(); alternately at least use Database::limitOffset() to generate the LIMIT/OFFSET portions in a way that'll work for the DB backend in use.

hans.spaans wrote:

Rewrite of mwe-newestpages-r50851-hspaans-1.patch

Attached:

Jdforrester-WMF subscribed.

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