limit/offset for postgresql #83

Closed
pbackx opened this Issue May 14, 2012 · 1 comment

Comments

Projects
None yet
2 participants
@pbackx

pbackx commented May 14, 2012

When executing the following:

UserConfig.paginate({limit: 4, page: page}, function(err, userconfigs) {
...
});

The following SQL is executed:

SELECT * FROM "UserConfig"  LIMIT 4 4

This is not correct. It should be:

SELECT * FROM "UserConfig"  LIMIT 4 OFFSET 4
@pbackx

This comment has been minimized.

Show comment Hide comment
@pbackx

pbackx May 14, 2012

Sorry, I'm not very experienced with pulling requests. But this is easily solved by changing line 265 of the postgres adapter:

if (filter.limit) {
    out += ' LIMIT ' + filter.limit + ' OFFSET ' + (filter.offset || '0');
}

(added the OFFSET keyword and the 0 default)

pbackx commented May 14, 2012

Sorry, I'm not very experienced with pulling requests. But this is easily solved by changing line 265 of the postgres adapter:

if (filter.limit) {
    out += ' LIMIT ' + filter.limit + ' OFFSET ' + (filter.offset || '0');
}

(added the OFFSET keyword and the 0 default)

anatoliychakkaev pushed a commit that referenced this issue Aug 31, 2012

Merge pull request #93 from mhuggins/pg-offset
Fix PostgreSQL query offset (issue #83)
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment