Re: argtype_inherit() is dead code

From: Tom Lane <tgl(at)sss(dot)pgh(dot)pa(dot)us>
To: elein(at)varlena(dot)com (elein)
Cc: pgsql-hackers(at)postgresql(dot)org
Subject: Re: argtype_inherit() is dead code
Date: 2005-04-16 19:39:55
Message-ID: 21045.1113680395@sss.pgh.pa.us
Views: Raw Message | Whole Thread | Download mbox | Resend email
Thread:
Lists: pgsql-hackers

elein(at)varlena(dot)com (elein) writes:
> Are you saying that the code was supposed "unflatten" the
> arguments of a function into a possible composite type taking into
> consideration the possible inheritance information of the
> composite type?

No, it didn't do that. AFAICT the case it was supposed to handle
was resolution of ambiguous function calls in what would amount to
an object-oriented-programming usage style. Consider

create table parent(...);

create table child(...) inherits (parent);

create table grandkid(...) inherits (child);

create function foo(parent) returns ...;

create function foo(child) returns ...;

select foo(t.*) from parent t; -- uses foo(parent), of course

select foo(t.*) from child t; -- uses foo(child), of course

select foo(t.*) from grandkid t; -- ambiguous

Our current code rejects the last with "ambiguous function call",
but an OOP user would expect it to choose foo(child) because that's
the nearer parent supertype. It looks to me like Postgres once
did choose foo(child), and argtype_inherit() was the code that made
this happen. It's been broken for a long time though --- at least
since 7.0, because 7.0 rejects this example.

Digging in the CVS history, it appears that I may have broken it here:
http://developer.postgresql.org/cvsweb.cgi/pgsql/src/backend/parser/parse_coerce.c.diff?r1=2.35;r2=2.36;f=h
It's quite possible that it failed even before that however; I don't
have a pre-7.0 server handy to check it on. In any case, given the lack
of complaints since 7.0, it doesn't seem anyone is trying to do this
kind of thing.

regards, tom lane

In response to

Responses

Browse pgsql-hackers by date

  From Date Subject
Next Message Tom Lane 2005-04-16 20:18:49 Re: Hash vs. HashJoin nodes
Previous Message elein 2005-04-16 17:32:34 Re: argtype_inherit() is dead code