Re: Domains and function arguments - Mailing list pgsql-hackers

From Peter Eisentraut
Subject Re: Domains and function arguments
Date
Msg-id Pine.LNX.4.44.0306171513380.2043-100000@peter.localdomain
Whole thread Raw
In response to Re: Domains and function arguments  (Tom Lane <tgl@sss.pgh.pa.us>)
Responses Re: Domains and function arguments
List pgsql-hackers
Tom Lane writes:

> Admittedly, we have trouble resolving the type to use when a function is
> overloaded with both a domain and a base type, but that's hardly
> surprising.

Even if you try to work it out, it's going to be a mess.  During
resolution, you would have to look inside the data to figure out which
domain, if any, it might fit into.  That means that the resolution of an
expression depends on the actual data, not just the structure of the data
(i.e., the data type).  Of course, an expression typically needs to be
resolved before the data is plugged in, so this approach cannot work.

If you insist on allowing domains in argument lists, then I think the best
approach is this:  For purpose of function resolution, types and all
domains defined over them are equivalent.  That would mean, for example,
that if you define positive_int as domain over int, then you cannot define
foofunc(int) and foofunc(positive_int) as the same time.

-- 
Peter Eisentraut   peter_e@gmx.net



pgsql-hackers by date:

Previous
From: Bruno Wolff III
Date:
Subject: Re: Errors compiling hba.c in current CVS
Next
From: Peter Eisentraut
Date:
Subject: Re: Our FLOAT(p) precision does not conform to spec