Re: UNION ALL - Var attno - Mailing list pgsql-hackers

From sri harsha
Subject Re: UNION ALL - Var attno
Date
Msg-id CAP6OGLHr_EqLaP-PtfuJxBLPOPqVfXqW+TV_-MyB7kjmfGU1_w@mail.gmail.com
Whole thread Raw
In response to Re: UNION ALL - Var attno  (Tom Lane <tgl@sss.pgh.pa.us>)
Responses Re: UNION ALL - Var attno  (Amit Langote <amitlangote09@gmail.com>)
Re: UNION ALL - Var attno  (Ashutosh Bapat <ashutosh.bapat@enterprisedb.com>)
Re: UNION ALL - Var attno  (Tom Lane <tgl@sss.pgh.pa.us>)
List pgsql-hackers

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 ??


Regards,
Harsha

On Fri, Apr 29, 2016 at 10:03 AM, Tom Lane <tgl@sss.pgh.pa.us> wrote:
sri harsha <sriharsha9992@gmail.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

pgsql-hackers by date:

Previous
From: Tom Lane
Date:
Subject: Re: VS 2015 support in src/tools/msvc
Next
From: Andreas Seltenreich
Date:
Subject: [sqlsmith] Failed assertion in BecomeLockGroupLeader