pg.ddx.io  pgsql-hackers@postgresql.org mailing list archive  
help / color / mirror / Atom feed
From: Tom Lane <tgl@sss.pgh.pa.us>
To: Jim Nasby <Jim.Nasby@BlueTreble.com>
Cc: Pg Hackers <pgsql-hackers@postgresql.org>
Subject: Re: Add support for SRF and returning composites to pl/tcl
Date: Fri, 06 Jan 2017 15:45:11 -0500
Message-ID: <22523.1483735511@sss.pgh.pa.us> (raw)
In-Reply-To: <d2c6425a-d9e0-f034-f774-4a872c234d89@BlueTreble.com>
References: <f2134651-14b3-efeb-f274-c69f3c084031@BlueTreble.com>
	<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>
	<d2c6425a-d9e0-f034-f774-4a872c234d89@BlueTreble.com>
List-Unsubscribe: <mailto:majordomo@postgresql.org?body=unsub%20pgsql-hackers>

Jim Nasby <Jim.Nasby@BlueTreble.com> 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



view thread (11+ messages)  latest in thread

Message-ID: <22523.1483735511@sss.pgh.pa.us>
Permalink:  ../22523.1483735511@sss.pgh.pa.us/
Also on:    postgresql.org/message-id/22523.1483735511@sss.pgh.pa.us

 · 

reply

Reply instructions:

You may reply publicly to this message via plain-text email
using any one of the following methods:

* Reply to all the recipients from your mail client; the link fills in
  the headers below: reply via email
  Some clients, webmail especially, drop In-Reply-To and References from
  a link, and the reply then starts a new thread: use the mbox below.

  To: pgsql-hackers@postgresql.org
  Cc: tgl@sss.pgh.pa.us, Jim.Nasby@BlueTreble.com
  Subject: Re: Add support for SRF and returning composites to pl/tcl
  In-Reply-To: <22523.1483735511@sss.pgh.pa.us>
  References: <f2134651-14b3-efeb-f274-c69f3c084031@BlueTreble.com> <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> <d2c6425a-d9e0-f034-f774-4a872c234d89@BlueTreble.com> <22523.1483735511@sss.pgh.pa.us>

* Save the following mbox file, import it into your mail client,
  and reply-to-all from there: mbox

This inbox is served by DDX for PostgreSQL; see mirroring instructions
for how to clone and mirror all data and code used for this inbox