Re: UNION ALL - Var attno

From: Ashutosh Bapat <ashutosh(dot)bapat(at)enterprisedb(dot)com>
To: sri harsha <sriharsha9992(at)gmail(dot)com>
Cc: Tom Lane <tgl(at)sss(dot)pgh(dot)pa(dot)us>, pgsql-hackers <pgsql-hackers(at)postgresql(dot)org>
Subject: Re: UNION ALL - Var attno
Date: 2016-04-29 07:05:49
Message-ID: CAFjFpRd3L2foEXJeahPuJzfkz24CUfV5Vw-37g84K2ptBr4e_w@mail.gmail.com
Views: Raw Message | Whole Thread | Download mbox | Resend email
Thread:
Lists: pgsql-hackers

On Fri, Apr 29, 2016 at 11:12 AM, sri harsha <sriharsha9992(at)gmail(dot)com>
wrote:

>
> Its not an OpExpr . It is a VAR , got it from "reltargetlist" in base
> relation ( RelOptInfo) . Can you shed some light on where the conversion
> from 141 to "original" attribute number takes place ??
>

If you try to print the node as *(Node *) node in a debugger, it will tell
you the type of node. What does that print?

> On Fri, Apr 29, 2016 at 10:03 AM, Tom Lane <tgl(at)sss(dot)pgh(dot)pa(dot)us> wrote:
>
>> sri harsha <sriharsha9992(at)gmail(dot)com> writes:
>> > Assume the following query ,
>> > (SELECT a * 1 , b FROM TABLE_1) UNION ALL (SELECT a *1 , b FROM
>> TABLE_2);
>>
>> > In this query , attribute number of the VARs are 141 and 2 respectively
>> !!
>>
>> I doubt it.
>>
>> Maybe you're looking at something that's not a Var, possibly an OpExpr,
>> but assuming it's a Var? The fact that 141 is the pg_proc OID of int4mul
>> lends considerable weight to this suspicion ...
>>
>> regards, tom lane
>>
>
>

--
Best Wishes,
Ashutosh Bapat
EnterpriseDB Corporation
The Postgres Database Company

In response to

Browse pgsql-hackers by date

  From Date Subject
Next Message Amit Kapila 2016-04-29 07:14:07 Re: [sqlsmith] Crash in apply_projection_to_path
Previous Message Abhijit Menon-Sen 2016-04-29 06:35:14 Re: 9.6 and fsync=off