I am trying to check the value of a column to in Postgresql to see if it equals a predefined value. However, this is ALWAYS returning true (even when the strings are most definitely not true)
IF (currentRecord.status)::text <> ('delivered')::text THEN
--Something
ELSE
--Something Else
END IF;
currentRecord
is of type RECORD
and is guaranteed to have a status value as it is never null. It is pending
by default.
There are no hidden characters or whitespaces and, as you can see, I’m trying to play it safe by casting both values to text
. I’ve also tried to sub <>
for !=
with no luck.
Apparently pending
(the default value in the table) is always equal to delivered
?
This makes me think it’s checking for a type
comparison versus a cell content/string comparison.
Any help would be appreciated!