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

From Rodolfo Campero
Subject PL/Python: domain over array support
Date
Msg-id CAHNrXgHnnGMuh1V_dSzrRrz7upD3R-xc5d+eHXai=a8NWoFNkQ@mail.gmail.com
Whole thread Raw
Responses Re: PL/Python: domain over array support  (Robert Haas <robertmhaas@gmail.com>)
Re: PL/Python: domain over array support  (Marko Kreen <markokr@gmail.com>)
List pgsql-hackers
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.

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.

Regards,
Rodolfo
Attachment

pgsql-hackers by date:

Previous
From: Gordon Mohr
Date:
Subject: Re: high-dimensional knn-GIST tests (was Re: Cube extension kNN support)
Next
From: Gordon Mohr
Date:
Subject: Re: high-dimensional knn-GIST tests (was Re: Cube extension kNN support)