Re: Lack of RelabelType is causing me pain

From: Tom Lane <tgl(at)sss(dot)pgh(dot)pa(dot)us>
To: Joe Conway <mail(at)joeconway(dot)com>
Cc: pgsql-hackers(at)postgreSQL(dot)org
Subject: Re: Lack of RelabelType is causing me pain
Date: 2003-11-10 23:06:15
Message-ID: 15883.1068505575@sss.pgh.pa.us
Views: Raw Message | Whole Thread | Download mbox | Resend email
Thread:
Lists: pgsql-hackers

Joe Conway <mail(at)joeconway(dot)com> writes:
> Tom Lane wrote:
>> Joe, do you recall the reasoning for this code in parse_coerce.c?
>> [much snipped]

> Does the RelabelType keep a record of what was relabeled (I presume from
> your description above it does)?

The RelabelType node itself doesn't, but you can look to its input node
to see the initial type. The code I was imagining adding to
get_fn_expr_argtype would go like

while (<node is a RelabelType with output ANYELEMENT/ANYARRAY/ANY>)
node := node->input;

to chain down to the first thing that isn't a Relabel. You can see
examples of this coding pattern in various places in the optimizer that
want to ignore binary-compatible relabelings.

> The original code above predates get_fn_expr_argtype() I think,

Oh, okay, if the coding predates 7.4 then I'm not so concerned about it.
I was afraid we'd done this as of 7.4, in which case there's no field
experience to indicate that it's really safe in corner cases.

I have found a workaround for my immediate problem with indexing
behavior, so I think we can leave parse_coerce.c as-is for the moment,
but I'm planning to keep my eyes open for any evidence that we ought to
reconsider the decision to omit RelabelType here. When RelabelType was
put in, the intention was that it would appear *anywhere* that the
actual output of one expression didn't match the expected input type of
its parent.

regards, tom lane

In response to

Browse pgsql-hackers by date

  From Date Subject
Next Message Bruce Momjian 2003-11-10 23:43:24 Re: Experimental patch for inter-page delay in VACUUM
Previous Message Bruce Momjian 2003-11-10 23:02:32 Re: [PATCHES] initdb in C