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

From Marko Kreen
Subject Re: PL/Python: domain over array support
Date
Msg-id 20131122093523.GA4650@gmail.com
Whole thread Raw
In response to PL/Python: domain over array support  (Rodolfo Campero <rodolfo.campero@anachronics.com>)
Responses Re: PL/Python: domain over array support
List pgsql-hackers
On Sat, Oct 26, 2013 at 11:17:19AM -0200, Rodolfo Campero wrote:
> The attached patch add support of domains over arrays to PL/Python (eg:
> CREATE DOMAIN my_domain AS integer[]).
> 
> Basically it just uses get_base_element_type instead of get_element_type
> in plpy_typeio.c, and uses domain_check before returning a sequence as
> array in PLySequence_ToArray whenever appropriate.

Generally looks fine.  Please lose the C++ comments though, this style
is not used in Postgres sources.

> There's one line I'm not sure about; I modified a switch statement (line
> 427):
>     switch (element_type ? element_type : getBaseType(arg->typoid))
> The rationale is that when element_type is set, it is already a base type,
> because there is no support of arrays of domains in PostgreSQL, but this
> may not held true in the future.

Was there any actual need to modify that?  Or was it just performance
optimization?  ATM it creates asymmetry between PLy_output_datum_func2
and PLy_input_datum_func2.

If it's just performace optimization, then it should be done in both
functions, but seems bad idea to do it in this patch.  So I think
it's better to leave it out.

-- 
marko




pgsql-hackers by date:

Previous
From: Pavel Stehule
Date:
Subject: Re: new unicode table border styles for psql
Next
From: "Etsuro Fujita"
Date:
Subject: Re: Get more from indices.