question-mark
Stuck on an issue?

Lightrun Answers was designed to reduce the constant googling that comes with debugging 3rd party libraries. It collects links to all the places you might be looking at while hunting down a tough bug.

And, if you’re still stuck at the end, we’re happy to hop on a call to see how we can help out.

Limit is not converted to integer

See original GitHub issue

I have this function:

exports.lastCovers = function(page, pageSize) {
  console.log(typeof pageSize)
  console.log(typeof page)
  return Cover.collection().query(function(qb) {
    qb.orderBy('registration_date', 'desc').limit(pageSize).offset((page - 1) * pageSize);
  }).fetch();
}

It prints:

string
string

And happens this error:

{ __cid: '__cid8',
  method: 'select',
  options: undefined,
  bindings: [ '20', 0 ],
  sql: 'select `cover`.* from `cover` order by `registration_date` desc limit ? offset ?' }
{ [Error: ER_PARSE_ERROR: You have an error in your SQL syntax; check the manual that corresponds to your MySQL server version for the right syntax to use near ''20' offset 0' at line 1]
  code: 'ER_PARSE_ERROR',
  errno: 1064,
  sqlState: '42000',
  index: 0 }

The offset is converted to integer but limit is not.

Issue Analytics

  • State:closed
  • Created 9 years ago
  • Comments:7 (4 by maintainers)

github_iconTop GitHub Comments

3reactions
VincentVazzocommented, Nov 17, 2015

In Postgres, at least, one can do “LIMIT ALL” in a query. It would be nice to be able to send in “ALL” (or an equivalent) into limit() and have it not emote a warning everytime.

0reactions
rhys-vdwcommented, Nov 17, 2015

@VincentVazzo Please open a new issue with this feature request. This issue is closed.

Read more comments on GitHub >

github_iconTop Results From Across the Web

Limit is not converted to integer · Issue #393 - GitHub
The offset is converted to integer but limit is not.
Read more >
ValueError: Exceeds the limit (4300) for integer string conversion
No efficient algorithm exists to do otherwise. It is quite common for Python code implementing network protocols and data serialization to do ...
Read more >
`int('1' * 4301)` will raise ValueError starting with Python 3.10.7
See the integer string conversion length limitation documentation. The default limit is 4300 digits in string form.
Read more >
Convert 18 digit string into number using int function
I am trying to make a flow that requires that i convert 18 digit "string" value into number. But since int have limit...
Read more >
Int/str conversions broken in latest Python bugfix releases
... Exceeds the limit (4300) for integer string conversion ... A library should not generally alter global state like this so it isn't ......
Read more >

github_iconTop Related Medium Post

No results found

github_iconTop Related StackOverflow Question

No results found

github_iconTroubleshoot Live Code

Lightrun enables developers to add logs, metrics and snapshots to live code - no restarts or redeploys required.
Start Free

github_iconTop Related Reddit Thread

No results found

github_iconTop Related Hackernoon Post

No results found

github_iconTop Related Tweet

No results found

github_iconTop Related Dev.to Post

No results found

github_iconTop Related Hashnode Post

No results found