Re: RFC for adding typmods to functions - Mailing list pgsql-hackers

From Tom Lane
Subject Re: RFC for adding typmods to functions
Date
Msg-id 5959.1258498912@sss.pgh.pa.us
Whole thread Raw
In response to Re: RFC for adding typmods to functions  (Andrew Dunstan <andrew@dunslane.net>)
Responses Re: RFC for adding typmods to functions
List pgsql-hackers
Andrew Dunstan <andrew@dunslane.net> writes:
> Apart from all these it's not clear to me what the major benefits of 
> doing this would be. I'd like an explanation of that to start with.

Well, aside from the issue about making "anyelement" more powerful
(which could be done in other ways), I can think of:

If we don't start down this path then we are never going to satisfy the
spec's expectations about type modifiers (the varchar concatenation
example among others).  The given patch doesn't do that or even come
close, but it's a necessary prelude.

More generally, people have complained in the past about typmods being
red-headed stepchildren in the type system.  At present, since the
majority of expression forms throw away typmod information, there's
not much hope of treating typmod on the same level as type proper.
(If you look at the history of the expression-tree code you'll notice
that we've gradually propagated typmods into more and more places.
Associating a typmod with function results is the last major holdout.)

I'm not sure that these points fully justify the work involved, but
it certainly seems to be a logical avenue of development if we can
agree on the semantics.
        regards, tom lane


pgsql-hackers by date:

Previous
From: Robert Haas
Date:
Subject: Re: plpgsql: open for execute - add USING clause
Next
From: Andrew Dunstan
Date:
Subject: Re: plperl and inline functions -- first draft