Re: RfD: more powerful "any" types - Mailing list pgsql-hackers

From David E. Wheeler
Subject Re: RfD: more powerful "any" types
Date
Msg-id 41DB8C95-6971-44C0-A59D-4E2CAA8811B3@kineticode.com
Whole thread Raw
In response to RfD: more powerful "any" types  (Alvaro Herrera <alvherre@commandprompt.com>)
Responses Re: RfD: more powerful "any" types
List pgsql-hackers
On Sep 8, 2009, at 9:12 AM, Alvaro Herrera wrote:

> foo(anyelement, anyelement) returns anyelement
>
> but this will force them to be both of the same type, which is not  
> what
> we want.  In my opinion this is a missing feature of our type system.

Oh yes, agreed. I've run into this with pgTAP many times.

> One seemingly trivial idea would be to have anyelement2, anyelement3,
> and so on.  This is not a very good solution, because we'd have to  
> fill
> the catalogs with a large bunch of new pseudotypes, and the code  
> with a
> bunch of hardcoded tests -- and there are already 27 cases of
> ANYELEMENTOID in our code.

Yes, and foo() might be called with two different data types, or two  
of the same, and both should work.

<snip what="other useful information" />

> Before I spend time trying to figure out how this works,
> 1. is there agreement that this is a problem and needs fixed, and

+1

> 2. does anybody have an idea how to attack it?

Why can't anyelement be freed from this constraint?

Best,

David



pgsql-hackers by date:

Previous
From: Alvaro Herrera
Date:
Subject: Re: Patch: update Bonjour support to the newer non-deprecated API
Next
From: Alvaro Herrera
Date:
Subject: Re: RfD: more powerful "any" types