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
returnlist must have even number of elements")));
and that would become
ereport(ERROR, (errcode(ERRCODE_INVALID_PARAMETER_VALUE), errmsg("column name/value list
musthave 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