I have the following Propel condition:
->addCond('cond3', 're.max_person_count', Criteria::ISNULL)
Which yields the following error: Invalid text representation: 7 ERROR: invalid input syntax for integer: „NULL“
Upon closer inspection, it seems that the SQL generated is the following:
... (re.max_person_count=:p3 OR ...
Instead of the desired:
... (re.max_person_count IS NULL OR ...
Why is Propel trying to insert a value when the Criteria
I have chosen is ISNULL
? What am I doing wrong?
It seems that using Criteria::ISNULL
yields some unpredictable behaviour that I was not able to explain (the corresponding generated SQL tried did not map to IS NULL
).
Here is the end result, which worked as I wished it to (in case anybody needs the question answered):
$resQuery = ResQuery::create()
->leftJoinTable('tbl')
->addCond('cond1', 'tbl_id', $tableId, Criteria::EQUAL)
->addCond('cond2', 'canceled', 'FALSE', Criteria::EQUAL)
->combine(array('cond1','cond2'), 'AND', 'cond1and2')
->addCond('cond3', 'tbl.max_count', null)
->addCond('cond4', 'tbl.max_count', '0', Criteria::GREATER_THAN)
->addCond('cond5', 'confirmed', 'TRUE', Criteria::EQUAL)
->combine(array('cond4', 'cond5'), 'AND', 'cond4and5')
->combine(array('cond3', 'cond4and5'), 'OR', 'cond3or4and5')
->where(array('cond1and2', 'cond3or4and5'), 'AND')
->find();