Column is of type Boolean but expression is of type text Hint: You will need to rewrite or cast the expression
19,499
Your column tentative
is a BOOLEAN
type; however, you are trying to update it with a TEXT
type value.
All you need to do is use BOOLEAN
in your update like so:
UPDATE table
SET tentative = CASE src.tentative WHEN 1 THEN TRUE ELSE FALSE END
FROM src_table src;
Alternatively, but maybe less obvious you can do this:
UPDATE table
SET tentative = (src.tentative = 1)
FROM src_table src;
Author by
Ramesh
Updated on June 09, 2022Comments
-
Ramesh almost 2 years
Can anyone help me with the error?
Update table SET tentative = case src.tentative WHEN 1 THEN 't' ELSE 'f' END FROM table
-
Nick Roz over 7 years't' and 'f' are valid literals of TRUE and FALSE