[SOLVED] Casting to Enums and custom types - PostgreSQL
Hello,
I am encountering the following error when I try to upsert on a PostgreSQL record where one of my arguments is an enum type. I assumed I would be able to use a string directly from my script arguments, but that does not seem to be the case.
Error:
I have also tried casting via
But I encounter the following error:
Windmill Version:
Windmill EE v1.491.5-27-gdfd8c4cd2
10 Replies
do the opposite, cast to text then currency
Thanks for the feedback. Unfortunately, upon applying your suggestion, I encounter the following error:
I also tried using the CAST() postgresql function. Not sure of other tricks I can use to get around this problem
Hey @rubenf, sorry to ping you, but the issue above is a blocker for my team and me. Do you have any other suggestions I can follow? Thanks
it's the opposite
$5::text::currency
Thanks for the reply. Unfortunately that doesn't work. I have also tried wrapping in brackets and case statement as bellow to no avail
What is the error you have?
The same as before.
do you have "returning" at the end of your insert statement?
Yes. My sql script resembles the following:
that's why you get this error, you should cast your custom type to text in the returning statement instead of *
It works now. Thank you very much. Didn't realize I had to cast the returning data as well.
I'll mark the title as solved