Received: from malur.postgresql.org ([217.196.149.56]) by arkaria.postgresql.org with esmtp (Exim 4.84_2) (envelope-from ) id 1cPbO8-00051I-8q for pgsql-hackers@arkaria.postgresql.org; Fri, 06 Jan 2017 20:45:24 +0000 Received: from localhost ([127.0.0.1] helo=postgresql.org) by malur.postgresql.org with smtp (Exim 4.84_2) (envelope-from ) id 1cPbO6-00048c-Ru for pgsql-hackers@arkaria.postgresql.org; Fri, 06 Jan 2017 20:45:22 +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.84_2) (envelope-from ) id 1cPbO6-00048V-8t for pgsql-hackers@postgresql.org; Fri, 06 Jan 2017 20:45:22 +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.84_2) (envelope-from ) id 1cPbNy-0000jh-MQ for pgsql-hackers@postgresql.org; Fri, 06 Jan 2017 20:45:21 +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 v06KjBJM022524; Fri, 6 Jan 2017 15:45:11 -0500 From: Tom Lane To: Jim Nasby cc: Pg Hackers Subject: Re: Add support for SRF and returning composites to pl/tcl In-reply-to: References: <8658.1478394740@sss.pgh.pa.us> <8785.1478456128@sss.pgh.pa.us> <0c54d5eb-c184-3df9-ab66-0b000380eab3@BlueTreble.com> <19165.1478615614@sss.pgh.pa.us> Comments: In-reply-to Jim Nasby message dated "Wed, 09 Nov 2016 18:41:40 -0600" MIME-Version: 1.0 Content-Type: text/plain; charset="us-ascii" Content-ID: <22522.1483735511.1@sss.pgh.pa.us> Date: Fri, 06 Jan 2017 15:45:11 -0500 Message-ID: <22523.1483735511@sss.pgh.pa.us> X-Pg-Spam-Score: -5.1 (-----) List-Archive: List-Help: List-ID: List-Owner: List-Post: List-Subscribe: List-Unsubscribe: X-Mailing-List: pgsql-hackers Precedence: bulk Sender: pgsql-hackers-owner@postgresql.org Jim Nasby writes: > On 11/8/16 8:33 AM, Tom Lane wrote: >> As things stand in HEAD, the behavior is about the same, but the error >> messages are not --- in one case they mention triggers and of course the >> other doesn't. There are a couple of other minor things in the way of >> unifying the two hunks of code, so I concluded it probably wasn't worth >> the trouble. But feel free to take another look if it bugs you. > I had to add a bit of cruft to pltcl_build_tuple_result but it's not > that bad. tg_tupdesc could potentially be eliminated, but I don't know > if it's really worth it. > Note that this does change some of the trigger error messages, but I > don't think that's really an issue? The only thing that seems significant is that we'd change the SQLSTATE for the "odd number of list items" error: pltcl_trigger_handler has ereport(ERROR, (errcode(ERRCODE_E_R_I_E_TRIGGER_PROTOCOL_VIOLATED), errmsg("trigger's return list must have even number of elements"))); and that would become ereport(ERROR, (errcode(ERRCODE_INVALID_PARAMETER_VALUE), errmsg("column name/value list must have even number of elements"))); But that's probably fine; it's hard to believe anyone is depending on this particular case --- and I think the argument that this is legitimately a TRIGGER_PROTOCOL_VIOLATED case is a bit thin anyway. While I was checking the patch to verify that it didn't change any behavior, I noticed that it did, and there's a pre-existing bug here: pltcl_build_tuple_result is applying utf_e2u to the Tcl_GetString results, but surely that should be utf_u2e instead. Fortunately we haven't shipped this code yet. regards, tom lane -- Sent via pgsql-hackers mailing list (pgsql-hackers@postgresql.org) To make changes to your subscription: http://www.postgresql.org/mailpref/pgsql-hackers