Hey <@U0EC2UPDF>, I was debugging an issue with my...
# exposed
k
Hey @tapac, I was debugging an issue with my code and finally found that the problem is that the
limit
function does not generate sql when the limit size is 0, as the function implementation is
Copy code
open fun queryLimit(size: Int, offset: Int, alreadyOrdered: Boolean) = buildString {
    if (size > 0) {
        append("LIMIT $size")
        if (offset > 0) {
            append(" OFFSET $offset")
        }
    }
}
Shouldn't be
if (size >= 0)
instead? My use case is that the limit size is generated dynamically, and when it is 0, the sql query results should be empty.
t
Hi, I will check how limit 0 implemented for all databases, because even on MySQL it has strange behaviour: Limit 0 - returns no rows, limit 0, 1000 -> returns first 1000 rows.
👍 1
k
Thanks I am using PostgreSql
👌 1