reecetech / django_informixdb

Informix database adapter for Django
https://pypi.org/project/django-informixdb/
Apache License 2.0
10 stars 11 forks source link

Calling exist on Queryset fails with syntax error. #38

Open stj-mv opened 1 year ago

stj-mv commented 1 year ago

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 commented 1 year ago

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.