Re: PL/Python: domain over array support - Mailing list pgsql-hackers

From Rodolfo Campero
Subject Re: PL/Python: domain over array support
Date
Msg-id CAHNrXgHsqSKv0fv5vaD93WZ+AaCd76asyQVpX=3H0xjFtPGqoA@mail.gmail.com
Whole thread Raw
In response to Re: PL/Python: domain over array support  (Heikki Linnakangas <hlinnakangas@vmware.com>)
List pgsql-hackers


2013/11/25 Heikki Linnakangas <hlinnakangas@vmware.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

pgsql-hackers by date:

Previous
From: "Etsuro Fujita"
Date:
Subject: Re: Get more from indices.
Next
From: Kyotaro HORIGUCHI
Date:
Subject: Re: UNION ALL on partitioned tables won't use indices.