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

ECSQL with VALUES(...),(...) has a limit #897

Open
JonasDov opened this issue Oct 22, 2024 · 0 comments
Open

ECSQL with VALUES(...),(...) has a limit #897

JonasDov opened this issue Oct 22, 2024 · 0 comments
Assignees
Labels
bug Something isn't working ecdb ecschema

Comments

@JonasDov
Copy link
Contributor

JonasDov commented Oct 22, 2024

The following ECSQL statement:

SELECT * FROM (VALUES(1), (2), (3))

Gets converted to:

SELECT [K0] FROM (SELECT 1 [K0] UNION ALL SELECT 2 UNION ALL SELECT 3)

This works fine when there are 500 or fewer statements. But with more than 500 statements, the following error is returned:
SQLite statement failed to prepare: BE_SQLITE_ERROR too many terms in compound SELECT (BE_SQLITE_ERROR).
For example passing the following ECSQL:

SELECT * FROM (VALUES(1), (2), (3), ..., (499), (500), (501))

Results in the error above.

This is because SELECT ... UNION ALL ... has a limit of 500 set, see: https://www.sqlite.org/limits.html#:~:text=Maximum%20Number%20Of%20Terms%20In%20A%20Compound%20SELECT%20Statement
And VALUES(...),(...) should not have a limit, see: https://www.sqlite.org/lang_select.html#values:~:text=6.-,The%20VALUES%20clause,-The%20phrase%20%22VALUES

@JonasDov JonasDov changed the title VALUES(...),(...) has a limit ECSQL with VALUES(...),(...) has a limit Oct 22, 2024
@grigasp grigasp added bug Something isn't working ecschema labels Oct 22, 2024
@grigasp grigasp added the ecdb label Dec 11, 2024
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
bug Something isn't working ecdb ecschema
Projects
None yet
Development

No branches or pull requests

3 participants