Re: RfD: more powerful "any" types

From: "David E(dot) Wheeler" <david(at)kineticode(dot)com>
To: Alvaro Herrera <alvherre(at)commandprompt(dot)com>
Cc: Pg Hackers <pgsql-hackers(at)postgresql(dot)org>
Subject: Re: RfD: more powerful "any" types
Date: 2009-09-08 16:19:39
Message-ID: 41DB8C95-6971-44C0-A59D-4E2CAA8811B3@kineticode.com
Views: Raw Message | Whole Thread | Download mbox | Resend email
Thread:
Lists: 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

In response to

Responses

Browse pgsql-hackers by date

  From Date Subject
Next Message Alvaro Herrera 2009-09-08 16:23:11 Re: RfD: more powerful "any" types
Previous Message Alvaro Herrera 2009-09-08 16:13:23 Re: Patch: update Bonjour support to the newer non-deprecated API