On Fri, Jan 9, 2015 at 7:14 AM, Deepak S <in.live...@live.in> wrote: > Sorry, it's not about querying. I am implementing an invalidation > mechanism for Postgres Query Cache as part of my masters project. In order > to this, I need to store details(like name) of each table the query uses. > In essence, I need to store the table names of the cached queries. > > Initially, I thought of writing a code that could extract the table names > but later discovered that it is a gargantuan task as I shall have to > include around 600 production rules as was hinted in a Stackoverflow > Exchange post. Hence, I thought of getting hold of the data structure used > for storing table names of a DB but I couldn't get it. >
For prototyping you might also find https://github.com/pganalyze/pg_query useful. Its a Ruby-based library that makes the Postgres parser easier to access from the outside, getting a list of tables from a query is trivial - but if you need the oids you'll have to do it like pgpool does. (feel free to ping me off-list about this) Best, -- Lukas Fittl Skype: lfittl Phone: +43 6991 2770651