Re: List of table names of a DB

From: Lukas Fittl <lukas(at)fittl(dot)com>
To: Deepak S <in(dot)live(dot)in(at)live(dot)in>
Cc: "pgsql-hackers(at)postgresql(dot)org" <pgsql-hackers(at)postgresql(dot)org>
Subject: Re: List of table names of a DB
Date: 2015-01-09 07:37:41
Message-ID: CAP53PkyXhBVJOzvs_Z4HKvRuFvfpcG5ZcHaVMozeJvw+Xe1bfA@mail.gmail.com
Views: Raw Message | Whole Thread | Download mbox | Resend email
Thread:
Lists: pgsql-hackers

On Fri, Jan 9, 2015 at 7:14 AM, Deepak S <in(dot)live(dot)in(at)live(dot)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

In response to

Browse pgsql-hackers by date

  From Date Subject
Next Message Michael Paquier 2015-01-09 07:48:51 Re: Compression of full-page-writes
Previous Message Michael Paquier 2015-01-09 07:34:52 Re: pg_rewind in contrib