Open Jacky56 opened 2 days ago
@Jacky56 Sorry but, I can't reproduce the error in Postgres
. I noticed you have a typo in your where
query (the column name is wrong, it should be Helloworld.test.any
not Helloworld.text.any
) but that raise AttributeError: object of type 'Helloworld' has no attribute 'text'
, but other than that everything works in my case.
EDIT:
You are right for CockroachDB
. I can reproduce that error which advises adding explicit type conversions to placeholder arguments.
Yeah, it's weird that CockroachDB requires the explicit type casting.
You can add an explicit type cast using one of these:
from piccolo.query.functions import Cast
from piccolo.querystring import QueryString
# This
await MyTable.select().where(MyTable.my_array_column.any(Cast(QueryString('{}', 'some_value'), Varchar())))
# Or just this:
await MyTable.select().where(MyTable.my_array_column.any(QueryString('{}'::varchar, 'some_value'))
I receive Query string compile errors when I use
Array.any
forpostgres
(cockroach) managerresult:
The work around is: