From: | Tom Lane <tgl(at)sss(dot)pgh(dot)pa(dot)us> |
---|---|
To: | Peter Eisentraut <peter_e(at)gmx(dot)net> |
Cc: | Kevin Grittner <Kevin(dot)Grittner(at)wicourts(dot)gov>, Robert Haas <robertmhaas(at)gmail(dot)com>, "David E(dot) Wheeler" <david(at)kineticode(dot)com>, Noah Misch <noah(at)leadboat(dot)com>, lr(at)pcorp(dot)us, pgsql-hackers(at)postgresql(dot)org |
Subject: | Re: Domains versus polymorphic functions, redux |
Date: | 2011-06-07 22:28:56 |
Message-ID: | 23554.1307485736@sss.pgh.pa.us |
Views: | Raw Message | Whole Thread | Download mbox | Resend email |
Thread: | |
Lists: | pgsql-hackers |
I wrote:
> Anyway, I think we're out of time to do anything about the issue for
> 9.1. I think what we'd better do is force a downcast in the context
> of matching to an ANYARRAY parameter, and leave the other cases to
> revisit later.
Attached is a draft patch to do the above. It's only lightly tested,
and could use some regression test additions, but it seems to fix
Regina's complaint.
Note that I changed coerce_type's behavior for both ANYARRAY and ANYENUM
targets, but the latter behavioral change is unreachable since the other
routines in parse_coerce.c will not match a domain-over-enum to ANYENUM.
I am half tempted to extend the patch so they will, which would allow
cases like this to work:
regression=# create type color as enum('red','green','blue');
CREATE TYPE
regression=# select enum_first('green'::color);
enum_first
------------
red
(1 row)
regression=# create domain dcolor as color;
CREATE DOMAIN
regression=# select enum_first('green'::dcolor);
ERROR: function enum_first(dcolor) does not exist
LINE 1: select enum_first('green'::dcolor);
^
HINT: No function matches the given name and argument types. You might need to add explicit type casts.
I'm unsure though if there's any support for this further adventure,
since it wouldn't be fixing a 9.1 regression.
Comments?
regards, tom lane
Attachment | Content-Type | Size |
---|---|---|
domains-match-anyarray-1.patch | text/x-patch | 9.3 KB |
From | Date | Subject | |
---|---|---|---|
Next Message | Brar Piening | 2011-06-07 22:57:59 | Re: smallserial / serial2 |
Previous Message | Robert Haas | 2011-06-07 22:17:57 | Re: heap vacuum & cleanup locks |