Re: PL/Python: domain over array support

From: Marko Kreen <markokr(at)gmail(dot)com>
To: Rodolfo Campero <rodolfo(dot)campero(at)anachronics(dot)com>
Cc: pgsql-hackers(at)postgresql(dot)org
Subject: Re: PL/Python: domain over array support
Date: 2013-11-22 09:35:23
Message-ID: 20131122093523.GA4650@gmail.com
Views: Raw Message | Whole Thread | Download mbox | Resend email
Thread:
Lists: 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

In response to

Responses

Browse pgsql-hackers by date

  From Date Subject
Next Message Etsuro Fujita 2013-11-22 09:42:59 Re: Get more from indices.
Previous Message Pavel Stehule 2013-11-22 08:26:43 Re: new unicode table border styles for psql