I’m having this issue in both Adobe ColdFusion and Lucee.
When I query PostgreSQL fields that have been created with this syntax:
CREATE TABLE VendorDB.enrollments (
id bigserial NOT NULL,
workflow_state VendorDB."enrollments__workflow_state" NOT NULL,
CONSTRAINT enrollments_pkey PRIMARY KEY (id)
);
which is a database a vendor created and has provided remote access, so we can’t update it.
Anyway, if I try using CFQUERYPARAM on it, it fails with:
ERROR: operator does not exist: canvas.enrollments__workflow_state = character varying
Hint: No operator matches the given name and argument types. You might need to add explicit type casts.
The cfqueryparam in the SQL Statement looks like this:
and e.workflow_state IN (<cfqueryparam value="#StatesToShow#" cfsqltype="CF_SQL_VARCHAR" list="Yes">)
If I change it to NOT use CFQUERYPARAM and the query works fine, but I lose its advantages.
Anyone seen this before? Any workarounds you know of for being able to use CFQUERYPARAM with this type of field in PostgreSQL?
This was my SQL Client’s (DBeaver) version of “Generate DDL” for the table/fields I did not create and have zero admin permissions on (Vendor created/provided). Read-only access for me.
Perhaps the vendor created the TYPE being used? I’ll ask them.
Doyou need to do something along the lines described here?
cast(workflow_state AS VARCHAR) IN (<cfqueryparam value="#StatesToShow#" cfsqltype="CF_SQL_VARCHAR" list="Yes">)
Also… humour me… use queryExecute instead of <cfquery>, and just pass the param as {value=StatesToShow, list=true} (ie: without a type). For all I know queryExecute is using the same parameter-handling implementation as <cfqueryparam> does, but it’s an easy experiment and worth a punt.