From: | Heikki Linnakangas <hlinnaka(at)iki(dot)fi> |
---|---|
To: | Pavel Stehule <pavel(dot)stehule(at)gmail(dot)com> |
Cc: | Jim Nasby <Jim(dot)Nasby(at)bluetreble(dot)com>, Dave Cramer <pg(at)fastcrypt(dot)com>, Alexey Grishchenko <programmerag(at)gmail(dot)com>, PostgreSQL Hackers <pgsql-hackers(at)postgresql(dot)org> |
Subject: | Re: PL/Python adding support for multi-dimensional arrays |
Date: | 2016-10-14 08:53:46 |
Message-ID: | f377b531-838e-9836-f85d-0b2dbb0e6ce9@iki.fi |
Views: | Raw Message | Whole Thread | Download mbox | Resend email |
Thread: | |
Lists: | pgsql-hackers |
On 10/11/2016 08:56 AM, Pavel Stehule wrote:
> 2016-10-11 7:49 GMT+02:00 Heikki Linnakangas <hlinnaka(at)iki(dot)fi>:
>
>> Unfortunately there are cases that are fundamentally ambiguous.
>>
>> create type comptype as (intarray int[]);
>> create function array_return() returns comptype[] as $$
>> return [[[[1]]]];
>> $$ language plpython;
>>
>> What does the function return? It could be two-dimension array of
>> comptype, with a single-dimension intarray, or a single-dimension comptype,
>> with a two-dimension intarray.
>>
>> We could resolve it for simpler cases, but not the general case. The
>> simple cases would probably cover most things people do in practice. But if
>> the distinction between a tuple and a list feels natural to Python
>> programmers, I think it would be more clear in the long run to have people
>> adjust their applications.
>
> I agree. The distinction is natural - and it is our issue, so we don't
> distinguish strongly.
Ok, let's do that then. Here is a patch set that does that. The first is
the main patch. The second patch adds some code to give a hint, if you
do that thing that whose behavior changed. That code isn't very pretty,
but I think a good error message is absolutely required, if we are to
make this change. Does anyone have better suggestions on how to catch
the common cases of that?
Please review. Are the docs and the error messages now clear enough on
this? We'll need a mention in the release notes too, when it's time for
that.
- Heikki
Attachment | Content-Type | Size |
---|---|---|
0001-Support-multi-dimensional-arrays-in-PL-python.patch | text/x-diff | 54.9 KB |
0002-Give-a-hint-when-is-incorrectly-used-for-a-composite.patch | text/x-diff | 15.9 KB |
From | Date | Subject | |
---|---|---|---|
Next Message | Christoph Berg | 2016-10-14 09:32:01 | Re: [PATCH] pg_filedump is broken |
Previous Message | vinayak | 2016-10-14 08:48:27 | Re: New SQL counter statistics view (pg_stat_sql) |