Re: Taking the "varattno" in "args" (where part of a query)

From: carla celiberti <carla(dot)celiberti(at)hotmail(dot)it>
To: "pgsql-hackers(at)postgresql(dot)org" <pgsql-hackers(at)postgresql(dot)org>
Subject: Re: Taking the "varattno" in "args" (where part of a query)
Date: 2013-05-10 13:44:41
Message-ID: DUB116-W151AC9BA9AA03D3409133D8BA50@phx.gbl
Views: Raw Message | Whole Thread | Download mbox | Resend email
Thread:
Lists: pgsql-hackers

I looked at the plan with the explaination of the query (see pag 9 of http://www.postgresql.org/files/developer/internalpics.pdf for an example) and I found a way to take varattno from a Query structure using FromExpr jointree and casting in the right way the list and node to arrive at the Var structure.

From: carla(dot)celiberti(at)hotmail(dot)it
To: pgsql-hackers(at)postgresql(dot)org
Subject: Taking the "varattno" in "args" (where part of a query)
Date: Wed, 8 May 2013 20:38:01 +0200

Hi everyone,
I'm working on a project and one of my task is trying to take the "where" part of the queries.I'm programming inside the function "exec_simple_query" in "postgres.c".I searched inside the source code and how I've understood I need to take the "varattno" in "args" in "qpqual", is it right?If yes, how do I have to save it in order to have it in that function?If no, what is the easiest way to take it?
Example: For a query: select firstname from friend where age=33The attributes of the table friends are: firstname, lastname, city, state, ageI need to have the number 5 because "age" is the fifth attribute of "friend".
Thanks

In response to

Browse pgsql-hackers by date

  From Date Subject
Next Message Peter Eisentraut 2013-05-10 13:50:55 Re: [PATCH] Make "psql -1 < file.sql" work as with "-f"
Previous Message Andres Freund 2013-05-10 13:33:15 Re: Concurrent HOT Update interference