Re: Domains and function arguments

From: Tom Lane <tgl(at)sss(dot)pgh(dot)pa(dot)us>
To: Peter Eisentraut <peter_e(at)gmx(dot)net>
Cc: PostgreSQL Development <pgsql-hackers(at)postgresql(dot)org>
Subject: Re: Domains and function arguments
Date: 2003-06-16 20:05:55
Message-ID: 6362.1055793955@sss.pgh.pa.us
Views: Raw Message | Whole Thread | Download mbox | Resend email
Thread:
Lists: pgsql-hackers

Peter Eisentraut <peter_e(at)gmx(dot)net> writes:
> The SQL standard does not allow functions to have domains as arguments.
> Semantically, they have a point.

I don't think they do. Declaring a domain as the input type seems a
very natural way of asserting that the function only works over a subset
of the base input type. For example, log() might usefully be declared
to take arguments from a "positivereal" domain.

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.

The present algorithm for ambiguous-function resolution is probably
excessively unfriendly to functions with domain inputs: it will match
them *only* when they are an exact match (ie, the input argument is
already declared or coerced to the domain type). I think that's bowing
quite far enough in the direction of the standard; I'd like to loosen
it someday, but don't have time to think about it more right now.

regards, tom lane

In response to

Responses

Browse pgsql-hackers by date

  From Date Subject
Next Message Yurgis Baykshtis 2003-06-16 20:12:36 Re: PostgreSQL and Windows
Previous Message ivan 2003-06-16 19:59:34 same new code