Re: Error code missing for "wrong length of inner sequence" error

From: Heikki Linnakangas <hlinnaka(at)iki(dot)fi>
To: Daniel Gustafsson <daniel(at)yesql(dot)se>
Cc: pgsql-hackers <pgsql-hackers(at)postgresql(dot)org>
Subject: Re: Error code missing for "wrong length of inner sequence" error
Date: 2020-10-02 11:44:54
Message-ID: 04615cd9-23b8-c1a7-40e2-d1be9451138d@iki.fi
Views: Raw Message | Whole Thread | Download mbox | Resend email
Thread:
Lists: pgsql-hackers

On 01/10/2020 14:21, Daniel Gustafsson wrote:
>> On 1 Oct 2020, at 12:54, Heikki Linnakangas <hlinnaka(at)iki(dot)fi> wrote:
>
>> Most checks when converting between SQL and Python types use the PLy_elog() function, which uses the genericc ERRCODE_EXTERNAL_ROUTINE_EXCEPTION error code, but I think ERRCODE_ARRAY_SUBSCRIPT_ERROR is better.
>
> On that note, wouldn't the dimension check errors in PLySequence_ToArray be
> just as well off using normal ereport()'s? Only one of them seem to error out
> in a way that could propagate an error from Python to postgres.

Yes, you are right. I was going to say that we are not very consistent
on when to use ereport() and when PLy_elog() in general, but looking
closer, we are. Outside the array-conversion functions, PLy_elog() is
only used when a Python C API call fails, and ereport() is used otherwise.

Patch attached.

- Heikki

Attachment Content-Type Size
0001-Tidy-up-error-reporting-when-converting-PL-Python-ar.patch text/x-patch 2.8 KB

In response to

Responses

Browse pgsql-hackers by date

  From Date Subject
Next Message Amit Langote 2020-10-02 11:56:32 a misbehavior of partition row movement (?)
Previous Message tsunakawa.takay@fujitsu.com 2020-10-02 09:20:32 RE: Transactions involving multiple postgres foreign servers, take 2