I'm trying to return, from information_schema.columns all the columns in a table except for the final column (i.e. ordinal_position less than a given value), but whenever I try to use the less than operator to compare cardinal_number datatypes, I get an error like value for domain information_schema.cardinal_number violates check constraint "cardinal_number_domain_check".
I've tried casting and re-casting, but I'm stuck. Nothing I've tried works. I can't even do ordinal_position < 10, using a hard-coded value.
Any help us appreciated....
UPDATE: I found a work around that doesn't use the < operator...
AND ordinal_position NOT IN (
SELECT MAX(ordinal_position)
FROM information_schema.columns
WHERE table_schema = 'my_schema'
AND table_name = 'my_table'
)
It's still curious that it doesn't let me use the < operator with the cardinal_number data type.