UNION ALL - Var attno - Mailing list pgsql-hackers

From sri harsha
Subject UNION ALL - Var attno
Date
Msg-id CAP6OGLEO34adJ9sdN9bLn6vtyrSDJO6f5k2=2MSsBpXvCvTOfg@mail.gmail.com
Whole thread Raw
Responses Re: UNION ALL - Var attno  (Tom Lane <tgl@sss.pgh.pa.us>)
List pgsql-hackers


Hi,

   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 !! What is the reason for this ??

I am trying to implement a FDW , so i need attribute numbers to fetch the respective columns from my data store . Due to this change in attribute numbers in the case of UNION ALL , this query doesn't provide the necessary output .

But in the plan its given as 1 and 2 respectively . So is there a mapping which PG maintains to convert from 141 to the original attribute number ??


Thanks,
Harsha

pgsql-hackers by date:

Previous
From: Craig Ringer
Date:
Subject: Re: pg_xlog -> pg_xjournal?
Next
From: Andrew Dunstan
Date:
Subject: Re: VS 2015 support in src/tools/msvc