How can I set a field to NULL using the Redshift Data API? #2619
-
According to the official doc, if you're using sql.Parameter:
It looks like we can't use either an empty string or a nil value, so what can I do besides using a default value or omitting the field if it is empty? In Go, I saw that we have the this field interface FieldMemberIsNull, but I'm not sure how to use it. Have anyone done this before? |
Beta Was this translation helpful? Give feedback.
Replies: 2 comments 6 replies
-
Hey @lucix-aws , thoughts? |
Beta Was this translation helpful? Give feedback.
-
Is that 2nd (link) supposed to be a code snippet? Both of those links go to redshift documentation. |
Beta Was this translation helpful? Give feedback.
I haven't used redshift, but based on their documentation there it does seem to be flatly impossible to parameterize a NULL as you've surmised. I think you'd have to put it into the
ExecuteStatementInput.Sql
value directly.Note that
Field
and its variantFieldMemberIsNull
is an unrelated union that only appears in operation responses, specifically only inGetStatementResultOutput.Records
. I assume that's how they model actual null values in records etc.