BUG #17662: Error on UPDATE with ()
The following bug has been logged on the website:
Bug reference: 17662
Logged by: Julio Figueiredo
Email address: julionti@gmail.com
PostgreSQL version: 14.4
Operating system: CENTOS8
Description:
The bellow command return : ERROR: source for a multiple-column UPDATE item
must be a sub-SELECT or ROW() expression
update table set
(column)=(value)
where 1=2
if I use
update table set
(column1,c2)=(v1,v2)
where 1=2
everithing is ok
PG Bug reporting form <noreply@postgresql.org> writes:
The bellow command return : ERROR: source for a multiple-column UPDATE item
must be a sub-SELECT or ROW() expression
update table set
(column)=(value)
where 1=2
The error is telling you what to do. You should write:
update table set
(column) = ROW(value)
where 1=2
The ROW keyword is optional for a multi-column row, since
(v1,v2) couldn't mean anything else. But if there's just
one item, the parentheses are noise; they don't turn it
into a row.
regards, tom lane