Re: Domains as Subtypes

From: elein <elein(at)varlena(dot)com>
To: Tom Lane <tgl(at)sss(dot)pgh(dot)pa(dot)us>
Cc: elein <elein(at)varlena(dot)com>, pgsql-hackers <pgsql-hackers(at)postgresql(dot)org>
Subject: Re: Domains as Subtypes
Date: 2006-03-25 00:10:53
Message-ID: 20060325001053.GG15165@varlena.com
Views: Raw Message | Whole Thread | Download mbox | Resend email
Thread:
Lists: pgsql-hackers

On Fri, Mar 24, 2006 at 06:27:13PM -0500, Tom Lane wrote:
> elein <elein(at)varlena(dot)com> writes:
> > Operators have the single distinction from functions in that when one argument
> > has an unknown type, then an exact match is tried with the unknown arg
> > type set to the known type. This code has always been in there.
>
> Yeah, but it's just a fast special case of the generic UNKNOWN handling
> in func_select_candidate. The domain special case in binary_oper_exact
> is a wart --- ideally it should be excised not enlarged ;-). It's
> mainly there because we didn't want to complicate func_select_candidate
> to deal with domains. If you're going to do the latter anyway, it may
> be possible to remove the domain special case in binary_oper_exact.

OK. I'll see what I can do.

>
> In any case, the patch is very poorly thought through: it will not
> behave reasonably if there are multiple levels of domains with different
> candidate operators attached to each domain. (I can tell you have not
> tested this: getBaseType drills all the way down, so mk_oper_arg_list
> isn't doing what you think.)

I did test this. But maybe not deep enough :(

> You need some kind of policy as to which
> candidate is more preferable if some are "closer" types on one input and
> some are "closer" on another, and binary_oper_exact is not the place for
> that kind of decision.

This policy was my intent, however, it need not be in binary_oper_exact.

> It's only supposed to be a fast short-circuit
> for the cases of exact matches and exact-after-substituting-other-type-
> for-UNKNOWN matches.

OK.
> If you make it do more you'll be upsetting some
> careful compromises in the type resolution rules.

If you know of any cases that are not tested in regression let me
know and I'll include them in my test cases. So far, I have
broken nothing that I know about. (Well, maybe during development
I, like, broke everything, but that was fixed :)

OK. Back to the code in the func sel context.

>
> regards, tom lane
>
> ---------------------------(end of broadcast)---------------------------
> TIP 2: Don't 'kill -9' the postmaster
>

elein
elein(at)varlena(dot)com

In response to

Browse pgsql-hackers by date

  From Date Subject
Next Message Josh Berkus 2006-03-25 00:45:48 Re: Domains as Subtypes
Previous Message Stephen Frost 2006-03-25 00:02:03 Re: Role incompatibilities