Discussion:
[Modeling-users] right-hand side of IN operator must be constant
Mario Ruggier
2003-11-22 08:05:04 UTC
Permalink
Hello!

I am attempting to use the tempting IN operator, however, it doesn't
like me doing that ;)
The field I am using it on is a nothing-special string attribute:

GeneralAdaptorException: Couldn't evaluate expression SELECT COUNT(*)
FROM SomeTable t0 WHERE ((t0.CREATEDATE > '2003-11-22 09:29:15.65' AND
t0.ACTION IN (one, two, three, four)) AND t0.USERNAME = 'john').
Reason: _sqlite.DatabaseError:right-hand side of IN operator must be
constant

The qualifier that I pass to fetchCount() is:

createdate>"2003-11-22 10:44:53.25" AND action IN
["one","two","three","four"] AND username=="john"

Am I misusing this, or is this a problem with the IN operator?

Cheers, mario
Sebastien Bigaret
2003-11-22 10:29:02 UTC
Permalink
Hi,

This is indeed a bug in the generation of the SQL statement --and a
quick check confirms that this affects every adaptors, not only
SQLite. I'm gonna look at that.

-- Sébastien.
Post by Mario Ruggier
Hello!
I am attempting to use the tempting IN operator, however, it doesn't like me
doing that ;)
GeneralAdaptorException: Couldn't evaluate expression SELECT COUNT(*) FROM
SomeTable t0 WHERE ((t0.CREATEDATE > '2003-11-22 09:29:15.65' AND t0.ACTION IN
_sqlite.DatabaseError:right-hand side of IN operator must be constant
createdate>"2003-11-22 10:44:53.25" AND action IN ["one","two","three","four"]
AND username=="john"
Am I misusing this, or is this a problem with the IN operator?
Cheers, mario
Sebastien Bigaret
2003-11-22 11:31:03 UTC
Permalink
Okay, please see ticket #847212 and the patch provided there:
https://sourceforge.net/tracker/index.php?func=detail&aid=847212&group_id=58935&atid=489335

Thanks for reporting, hopefully this should fix the problem (and fixes
the very same problem for date, BTW).

-- Sébastien.
Post by Mario Ruggier
Hello!
I am attempting to use the tempting IN operator, however, it doesn't like me
doing that ;)
GeneralAdaptorException: Couldn't evaluate expression SELECT COUNT(*) FROM
SomeTable t0 WHERE ((t0.CREATEDATE > '2003-11-22 09:29:15.65' AND t0.ACTION IN
_sqlite.DatabaseError:right-hand side of IN operator must be constant
createdate>"2003-11-22 10:44:53.25" AND action IN ["one","two","three","four"]
AND username=="john"
Am I misusing this, or is this a problem with the IN operator?
Cheers, mario
Mario Ruggier
2003-11-23 06:23:01 UTC
Permalink
Thanks Sébastien, that fixes the problem.

Running the tests after applying the patch I get the little
error below. Not sure if this is coming form this patch or not,
but must be a small typo introduced recently.

Cheers, mario

% python run.py
Traceback (most recent call last):
File "run.py", line 42, in ?
import test_PyModel
File "./test_PyModel.py", line 34, in ?
from Modeling.PyModel import *
File "<string>", line 528
<<<<<<< PyModel.py
^
IndentationError: expected an indented block
Post by Sebastien Bigaret
https://sourceforge.net/tracker/
index.php?func=detail&aid=847212&group_id=58935&atid=489335
Thanks for reporting, hopefully this should fix the problem (and
fixes
the very same problem for date, BTW).
-- Sébastien.
Post by Mario Ruggier
Hello!
I am attempting to use the tempting IN operator, however, it doesn't
like me
doing that ;)
GeneralAdaptorException: Couldn't evaluate expression SELECT
COUNT(*) FROM
SomeTable t0 WHERE ((t0.CREATEDATE > '2003-11-22 09:29:15.65' AND
t0.ACTION IN
_sqlite.DatabaseError:right-hand side of IN operator must be constant
createdate>"2003-11-22 10:44:53.25" AND action IN
["one","two","three","four"]
AND username=="john"
Am I misusing this, or is this a problem with the IN operator?
Cheers, mario
Loading...