It seems that there are still a few problems with the resolution of
functions that have domains as arguments.

Take these two domains:

create domain testdomain1 as int;
create domain testdomain2 as int;

Take these two functions:

create function foofunc(testdomain1) returns int as 'select 1' language sql;
create function foofunc(testdomain2) returns int as 'select 2' language sql;

Calling foofunc(1) fails with the usual error message.

Take these two functions:

create function foofunc(testdomain1) returns int as 'select 1' language sql;
create function foofunc(int) returns int as 'select 2' language sql;

Calling foofunc(1) calls the second function.  This is wrong, because int
and testdomain2 are equivalent types, so the behavior should be identical
to the above.

Take these two functions:

create function foofunc(testdomain1) returns int as 'select 1' language sql;
create function foofunc(bigint) returns int as 'select 2' language sql;

Calling foofunc(1) fails with the usual error message.  This is wrong,
because testdomain1 is equivalent to int, and had we written foofunc(int),
that's the one that would have been called, in preference to
foofunc(bigint).

The SQL standard does not allow functions to have domains as arguments.
Semantically, they have a point.  Domains are not distinct types from
their base types, just different ranges within those types, and the choice
of function should just depend on the nature of the data, not in which
range it was declared to fall.  I think we should consider following the
standard.

-- 
Peter Eisentraut   [EMAIL PROTECTED]


---------------------------(end of broadcast)---------------------------
TIP 1: subscribe and unsubscribe commands go to [EMAIL PROTECTED]

Reply via email to