Re: PL/Python: domain over array support

From: Rodolfo Campero <rodolfo(dot)campero(at)anachronics(dot)com>
To: Heikki Linnakangas <hlinnakangas(at)vmware(dot)com>
Cc: Marko Kreen <markokr(at)gmail(dot)com>, "pgsql-hackers(at)postgresql(dot)org" <pgsql-hackers(at)postgresql(dot)org>
Subject: Re: PL/Python: domain over array support
Date: 2013-11-26 03:46:48
Message-ID: CAHNrXgHsqSKv0fv5vaD93WZ+AaCd76asyQVpX=3H0xjFtPGqoA@mail.gmail.com
Views: Raw Message | Whole Thread | Download mbox | Resend email
Thread:
Lists: pgsql-hackers

2013/11/25 Heikki Linnakangas <hlinnakangas(at)vmware(dot)com>
[...]

> This does change the behavior of any existing functions that return a
> domain over array. For example:
>
> postgres=# create domain intarr as integer[];
> CREATE DOMAIN
> postgres=# create function intarr_test() returns intarr as $$
> return '{1,2}'
> $$ language plpythonu;
> CREATE FUNCTION
>
> Before patch:
>
> postgres=# select intarr_test();
> intarr_test
> -------------
> {1,2}
> (1 row)
>
> After patch:
>
> postgres=# select intarr_test();
> ERROR: invalid input syntax for integer: "{"
> CONTEXT: while creating return value
> PL/Python function "intarr_test"
>
>
> The new behavior is clearly better, but it is an incompatibility
> nonetheless. I don't do anything with PL/python myself, so I don't have a
> good feel of how much that'll break people's applications. Probably not
> much I guess. But warrants a mention in the release notes at least. Any
> thoughts on that?
>
> - Heikki
>

Bear in mind that the same goes for receiving domains over arrays as
parameters; instead of seeing a string (previous behavior), with this patch
a function will see a list from the Python side (the function
implementation). A mention in the release notes is in order, I agree with
that.

I can't speak for other people, but I guess using domains over arrays as
parameters and/or return values in plpythonu functions should be rare,
considering the current behavior and especially given the possibility of
using a regular array in order to handle array values a lists in Python.

Regards,
--
Rodolfo

In response to

Browse pgsql-hackers by date

  From Date Subject
Next Message Kyotaro HORIGUCHI 2013-11-26 05:13:57 Re: UNION ALL on partitioned tables won't use indices.
Previous Message Etsuro Fujita 2013-11-26 03:30:03 Re: Get more from indices.