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

Calling exist on Queryset fails with syntax error. #38

Open
stj-mv opened this issue Mar 17, 2023 · 1 comment
Open

Calling exist on Queryset fails with syntax error. #38

stj-mv opened this issue Mar 17, 2023 · 1 comment

Comments

@stj-mv
Copy link

stj-mv commented Mar 17, 2023

Model:

class M(models.Model):
id = models.IntegerField(primary_key=True)

v = M.objects.all()
v.exists()

Generated SQL statement:
SELECT FIRST 1 ? AS a FROM m
PARAMS = (1,)

Returned error:
[Informix][Informix ODBC Driver][Informix]A syntax error has occurred. (-201) (SQLPrepare)

This works fine in isql and dbaccess (without params).

Could anyone confirm this? Any ideas?

@stj-mv
Copy link
Author

stj-mv commented Mar 17, 2023

Additional info:
As far as I know, fieldnames cannot be a bound item and must be a literal.
So the bad SQL statement should be

SELECT FIRST 1 1 AS a FROM m

Correct me if I'm wrong.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

No branches or pull requests

1 participant