Support for PostGres enum columns


#1

Hi all,

Still seeing this in version 0.30. I’m trying to create a category dropdown of enumerated types on a column where the column datatype is an enum type defined as ‘payment_status’ with values ‘PAID’,‘PAID_ELSEWHERE’ and ‘NOT_PAID’, on the custom query:

SELECT count(*) AS "count", CAST("public"."invoice_status"."incoming_timestamp" AS date) AS "incoming_timestamp"
FROM "public"."invoice_status"
LEFT JOIN "public"."company_mapping" "company_mapping__via" ON "public"."invoice_status"."company_id" = "company_mapping__via"."company_id"
WHERE {{pstatus}}
GROUP BY CAST("public"."invoice_status"."incoming_timestamp" AS date)
ORDER BY CAST("public"."invoice_status"."incoming_timestamp" AS date) ASC

The category dropdown is CORRECTLY created with the different enum types, but whenever I try to apply the pstatus filter, i get:

org.postgresql.util.PSQLException: ERROR: operator does not exist: payment_status = character varying Hint: No operator matches the given name and argument type(s). You might need to add explicit type casts. Position: 487

To ensure it was of the correct type, I also set the column type to ‘ENUM’ for the ‘payment_state’ column in the data model, which is the one to be filtered on

I tried adding a cast to payment_status in the WHERE clause like so, but I wasn’t expecting it to work based on the format of the underlying ORM:

WHERE {{pstatus}}::payment_status

or

WHERE CAST({{pstatus}} AS payment_status)

Is this still an outstanding issue or have I formatted the variable wrongly? Support for the cast is definitely there, because If I change the variable type to TEXT, and cast the variable to ‘payment_status’, typing in the enumeration value correctly filters the data and returns a result.

Thanks in advance,

Shrike71


#2

A quick search suggests that there’s still somethiing like that open yes. (Sorry Didn’t read details to carefully - as i gotta’ run now)