Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

GET /posts fails with ?limit=all parameter on SQLite instances #11303

Closed
naz opened this issue Oct 29, 2019 · 2 comments
Closed

GET /posts fails with ?limit=all parameter on SQLite instances #11303

naz opened this issue Oct 29, 2019 · 2 comments
Assignees
Labels
bug [triage] something behaving unexpectedly help wanted [triage] Ideal issues for contributors to help with pinned [triage] Ignored by stalebot server / core Issues relating to the server or core of Ghost

Comments

@naz
Copy link
Contributor

naz commented Oct 29, 2019

Issue Summary

The issue happens when running Ghost 3.0 on the SQLite database with the number of posts having posts_meta records that exceed 999.

When issuing the following Admin API request (same works for Content API):

GET /ghost/api/v3/admin/posts/?limit=all

It fails with 400, type: BadRequestError and code: SQLITE_ERROR.

In the internal logs following error show up:

Error: SQLITE_ERROR: too many SQL variables

It's a direct result of SELECT statement that has all posts listed in IN clause when the max limit for SQL parameters is 999.

Relevant discussion and small workaround the issue: #11300.

To Reproduce

  1. Set up an instance on SQLite database
  2. Create 1000 posts with meta_* entries
  3. Call GET /posts with ?limit=all parameter (e.g. through Ghost-SDK with following script https://gist.github.com/gargol/b71619cb04d35e0de97a91f8b41f95a0)

The expectation would be having all posts fetched with no error.

Technical details:

  • Ghost Version: 3.0.0
  • Node Version: v10.15.1
  • Database: SQLite 3.22.0
  • OS: Ubuntu 18.04
@naz naz added bug [triage] something behaving unexpectedly data server / core Issues relating to the server or core of Ghost labels Oct 29, 2019
@stale
Copy link

stale bot commented Jan 27, 2020

This issue has been automatically marked as stale because it has not had recent activity. It will be closed if no further activity occurs. Thank you for your contributions.

@stale stale bot added the stale [triage] Issues that were closed to to lack of traction label Jan 27, 2020
@naz naz added help wanted [triage] Ideal issues for contributors to help with pinned [triage] Ignored by stalebot and removed stale [triage] Issues that were closed to to lack of traction labels Jan 28, 2020
@ErisDS ErisDS self-assigned this Jun 29, 2020
@ErisDS
Copy link
Member

ErisDS commented Jul 9, 2020

Closing this against #12032 as this is now fixed in SQLite 3.32, which is soon to be the default.

The correct solution is to upgrade SQLite3

@ErisDS ErisDS closed this as completed Jul 9, 2020
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
bug [triage] something behaving unexpectedly help wanted [triage] Ideal issues for contributors to help with pinned [triage] Ignored by stalebot server / core Issues relating to the server or core of Ghost
Projects
None yet
Development

No branches or pull requests

2 participants