Обсуждение: How to make update statement to work
I want to nullify fields which does not exist in reference table.
I tried
UPDATE demo.toode SET "liik"=NULL, "grupp"=NULL WHERE ("grupp", "liik") NOT IN
(SELECT("grupp", "liik") FROM "artliik")
but this causes error:
ERROR: operator does not exist: character = record
HINT: No operator matches the given name and argument type(s). You may need
to add explicit type casts.
How to write this UPDATE statement properly ?
"Andrus Moor" <nospameetasoftnospam@online.ee> writes:
> UPDATE demo.toode
> SET "liik"=NULL, "grupp"=NULL
> WHERE ("grupp", "liik") NOT IN
> (SELECT ("grupp", "liik") FROM "artliik")
> ERROR: operator does not exist: character = record
> How to write this UPDATE statement properly ?
Hmm ... Postgres wants it without the innermost parentheses: (SELECT "grupp", "liik" FROM "artliik")
Offhand though I am not certain whether the way you wrote it is supposed
to be allowed according to the SQL spec. Does anyone think this should
have worked, and if so what's the chapter and verse that says so?
regards, tom lane