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

[expired user #9707]'s profile image [expired user #9707] posted 7 years ago in General Permalink

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

Code modification/commit 7bd29f0 from ansgarbecker, 7 years ago, revision 5130
Cast unknown data type columns as text when generating a multi column filter from user input. See
ansgar's profile image ansgar posted 7 years ago Permalink

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

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