Received: from malur.postgresql.org ([2a02:16a8:dc51::56]) by arkaria.postgresql.org with esmtps (TLS1.2:ECDHE_RSA_AES_256_CBC_SHA384:256) (Exim 4.89) (envelope-from ) id 1fSa8d-00021H-F2 for pgsql-bugs@arkaria.postgresql.org; Tue, 12 Jun 2018 03:38:31 +0000 Received: from localhost ([127.0.0.1] helo=malur.postgresql.org) by malur.postgresql.org with esmtp (Exim 4.89) (envelope-from ) id 1fSa8b-0006H4-TS for pgsql-bugs@arkaria.postgresql.org; Tue, 12 Jun 2018 03:38:29 +0000 Received: from magus.postgresql.org ([2a02:c0:301:0:ffff::29]) by malur.postgresql.org with esmtps (TLS1.2:ECDHE_RSA_AES_256_CBC_SHA384:256) (Exim 4.89) (envelope-from ) id 1fSa8b-0006Gv-NE for pgsql-bugs@lists.postgresql.org; Tue, 12 Jun 2018 03:38:29 +0000 Received: from sss.pgh.pa.us ([66.207.139.130]) by magus.postgresql.org with esmtps (TLS1.2:ECDHE_RSA_AES_256_CBC_SHA384:256) (Exim 4.89) (envelope-from ) id 1fSa8Z-0006bA-50 for pgsql-bugs@lists.postgresql.org; Tue, 12 Jun 2018 03:38:29 +0000 Received: from sss1.sss.pgh.pa.us (localhost [127.0.0.1]) by sss.pgh.pa.us (8.14.4/8.14.4) with ESMTP id w5C3cNh8022080; Mon, 11 Jun 2018 23:38:24 -0400 From: Tom Lane To: 110876189@qq.com cc: pgsql-bugs@lists.postgresql.org Subject: Re: BUG #15237: I got "ERROR: source for a multiple-column UPDATE item must be a sub-SELECT or ROW() expression" In-reply-to: <152876885706.32361.1270737678956483321@wrigleys.postgresql.org> References: <152876885706.32361.1270737678956483321@wrigleys.postgresql.org> Comments: In-reply-to =?utf-8?q?PG_Bug_reporting_form?= message dated "Tue, 12 Jun 2018 02:00:57 -0000" MIME-Version: 1.0 Content-Type: text/plain; charset="UTF-8" Content-ID: <22078.1528774703.1@sss.pgh.pa.us> Content-Transfer-Encoding: 8bit Date: Mon, 11 Jun 2018 23:38:23 -0400 Message-ID: <22079.1528774703@sss.pgh.pa.us> List-Id: List-Help: List-Subscribe: List-Post: List-Owner: List-Archive: Precedence: bulk =?utf-8?q?PG_Bug_reporting_form?= writes: > On PostgreSQL 11 Beta, I exec sql like "update > fvt_obj_operate_update_table_033 set (c_int) = (20) where c_int = 20;", > which only on column to set, got ""ERROR: source for a multiple-column > UPDATE item must be a sub-SELECT or ROW() expression"". It's telling you what to do: use a ROW() expression, ie update fvt_obj_operate_update_table_033 set (c_int) = row(20) where c_int = 20; > But I exec sql like "update fvt_obj_operate_update_table_033 set > (c_int,c_dp) = (20,1.11) where c_int = 20;", got successfull message. (20) and row(20) are not the same thing, whereas (20,1.11) and row(20,1.11) are the same thing. Don't blame us, it was the SQL committee's idea that "ROW" should be optional for the latter. > The cause of this error is because syntax rule conflict between "'(' a_expr > ')' opt_indirection" and "implicit_row: '(' expr_list ',' a_expr ')'".I > think "'(' a_expr ')'" is also a subset of row. > I want to modify it, but didn‘t got a good idea. Don't even think about it. It's unfixable without creating even worse problems, like causing an extra pair of parentheses to change the meaning of an expression. regards, tom lane