distal-attribute
distal-attribute
distal-attribute
distal-attribute

Cast unknown data types to TEXT to avoid query errors with postgresql?

bherila posted 12 months ago in General

When using the "Multi-column filter" function postgresql throws an error if we try to compare a non-string column value to a string. This can be bypassed by casting the field to a string, i.e.

select * from mytable where mycolumn::text LIKE '%filtertext%'

Consider adding the ::text to columns which aren't already VARCHAR or TEXT or have a matching regex as in numbers, UUIDs, and maybe-soon datetimes?

Thanks, Ben

ansgar posted 12 months ago

r5130 should cast unknown data type columns to ::text.

Please login to leave a reply, or register at first.