Re: PL/Python adding support for multi-dimensional arrays - Mailing list pgsql-hackers

From Heikki Linnakangas
Subject Re: PL/Python adding support for multi-dimensional arrays
Date
Msg-id f377b531-838e-9836-f85d-0b2dbb0e6ce9@iki.fi
Whole thread Raw
In response to Re: PL/Python adding support for multi-dimensional arrays  (Pavel Stehule <pavel.stehule@gmail.com>)
Responses Re: PL/Python adding support for multi-dimensional arrays  (Jim Nasby <Jim.Nasby@BlueTreble.com>)
Re: PL/Python adding support for multi-dimensional arrays  (Pavel Stehule <pavel.stehule@gmail.com>)
List pgsql-hackers
On 10/11/2016 08:56 AM, Pavel Stehule wrote:
> 2016-10-11 7:49 GMT+02:00 Heikki Linnakangas <hlinnaka@iki.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

pgsql-hackers by date:

Previous
From: vinayak
Date:
Subject: Re: New SQL counter statistics view (pg_stat_sql)
Next
From: Christoph Berg
Date:
Subject: Re: [PATCH] pg_filedump is broken