Re: Domains and function arguments

From: Peter Eisentraut <peter_e(at)gmx(dot)net>
To: Tom Lane <tgl(at)sss(dot)pgh(dot)pa(dot)us>
Cc: PostgreSQL Development <pgsql-hackers(at)postgresql(dot)org>
Subject: Re: Domains and function arguments
Date: 2003-06-17 18:03:18
Message-ID: Pine.LNX.4.44.0306171513380.2043-100000@peter.localdomain
Views: Raw Message | Whole Thread | Download mbox | Resend email
Thread:
Lists: 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(at)gmx(dot)net

In response to

Responses

Browse pgsql-hackers by date

  From Date Subject
Next Message Peter Eisentraut 2003-06-17 18:04:42 Re: [HACKERS] Our FLOAT(p) precision does not conform to spec
Previous Message Bruno Wolff III 2003-06-17 16:34:53 Re: Errors compiling hba.c in current CVS