PEAR is archived and read-only

This mirror preserves historical PEAR package releases and metadata so existing references remain available.

Home » Database » DB » Bug #380

Problem with LIMIT in pgsql PEAR::DB

Details

Submitted2003-12-08 17:10 UTC
Frommartin at bugs dot unl dot edu dot ar
Assignedtuupola
StatusClosed
PackageDB
PHP VersionIrrelevant
OSLinux
Roadmaps(Not assigned)

Comments

[2003-12-08 17:10 UTC] martin at bugs dot unl dot edu dot ar

Description:
------------
Aparently the changes in PostgreSQL from 7.2.x to the 7.3.x series chaged the behaviour of LIMIT in the select clause.
Before 7.3 you could use either LIMIT #,# or LIMIT # OFFSET #. Now (7.3 and latter) only the former is valid.

This would give errors when using limitQuery and modifyLimitQuery().

So, in DB/pgsql.php, this:

// }}}
// {{{ modifyLimitQuery()

function modifyLimitQuery($query, $from, $count)
{
$query = $query . " LIMIT $count, $from";
return $query;
}

Should be changed to this:

// }}}
// {{{ modifyLimitQuery()

function modifyLimitQuery($query, $from, $count)
{
$query = $query . " LIMIT $count OFFSET $from";
return $query;
}

[2004-01-09 08:53 UTC] tuupola at php dot net

Thank you for your bug report. This issue has already been fixed
in the latest released version of the package, which you can download at
http://pear.php.net/packages.php