Re: transforms - Mailing list pgsql-hackers

From Chapman Flack
Subject Re: transforms
Date
Msg-id 6803EB39.7060300@acm.org
Whole thread Raw
In response to Re: transforms [was Re: FmgrInfo allocation patterns (and PL handling as staged programming)]  (Chapman Flack <jcflack@acm.org>)
Responses Re: transforms
List pgsql-hackers
Also noticing about transforms:

1. protrftypes can have duplicates.

   In part, this is because CreateFunction does nothing to stop you saying
   redundant things like TRANSFORM FOR TYPE circle, FOR TYPE circle.

   But it is also because:

2. CreateFunction hands every type seen in TRANSFORM FOR TYPE
   to get_base_element_type, so if you write something like
   TRANSFORM FOR TYPE circle, FOR TYPE circle[], FOR TYPE arrcircle
   (where arrcircle is a domain over circle[]), protrftypes simply
   ends up {circle,circle,circle}.

3. get_base_element_type leaves alone a domain whose base type is not
   an array, so if bigcircle is a domain over circle, then
   TRANSFORM FOR TYPE bigcircle, FOR TYPE bigcircle[] will add
   {bigcircle,bigcircle} to protrftypes.

4. CreateTransform makes no use of get_base_element_type, but does reject
   any type that is a domain.

   Therefore:

5. You can create a transform for an array type, but can never refer to it
   in TRANSFORM FOR TYPE (you end up referring to the element type).

6. You can refer to a domain in TRANSFORM FOR TYPE, but that transform
   can never be created.

These don't seem to be what the rules ought to be, but I don't have
a strong intuition for what the rules ought to be instead.

Regards,
-Chap



pgsql-hackers by date:

Previous
From: Tom Lane
Date:
Subject: Re: What's our minimum supported Python version?
Next
From: Tom Lane
Date:
Subject: Re: transforms