Re: Domains and function arguments
| От | Tom Lane |
|---|---|
| Тема | Re: Domains and function arguments |
| Дата | |
| Msg-id | 6362.1055793955@sss.pgh.pa.us обсуждение исходный текст |
| Ответ на | Domains and function arguments (Peter Eisentraut <peter_e@gmx.net>) |
| Ответы |
Re: Domains and function arguments
|
| Список | pgsql-hackers |
Peter Eisentraut <peter_e@gmx.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
В списке pgsql-hackers по дате отправления: