-
Notifications
You must be signed in to change notification settings - Fork 0
Limit
Christoph Herrmann edited this page Oct 17, 2019
·
3 revisions
const limit = 5
const fallbackLimit = 15
const maxLimit = 50
const result = await sql.query(sql`
SELECT * FROM users ${sql.limit(limit, { fallbackLimit, maxLimit })}
`)
// text: SELECT * FROM users LIMIT 5
// values: []The default fallbackLimit 10 can be changed by setting sql.defaultFallbackLimit.
The default maxLimit 100 can be changed by setting sql.defaultMaxLimit.
The limit is dedicated validated and set into the text without parameter placeholder, because a placeholder don't care about the number is negative or positive and a negative number for the limit would result in a SQL error.
Found a bug or missing a feature? -> Create a new Issue
Found a security issue? -> Look at the Security Policy
Having questions, want to give feedback or talk to me? -> E-Mail me sql-pg@sharaal.de