From: suzhiyang <suzhiyang@gmail.com>
To: pgsql-hackers <pgsql-hackers@postgresql.org>
Subject: Distinguish view and table problem
Date: Fri, 18 Dec 2009 23:57:53 +0800
Message-ID: <200912182357482650255@gmail.com> (raw)
Hi!
I just want to distinguish a view and a table while postgres execute exec_simple_query(). In the systable of pg_class, a view and a table has different relkind ('r' 'v'). But when I print the parsetree and the rewrite parsetree, I found that a view and a table has no character to distinguish because the structure Relation has no attribute called relkind. Maybe I should read systable to confirm that we are select from a view or table? But there's still has problem. How could I get the relkind of a table(view) by its name from pg_class?
Another question is that does postgres save the user's original query_string at anywhere(systable etc.)? If I want to save the sourceText in the systable, I could add a column to pg_class called query_string. How could I insert a line to pg_class or read a line from it?
Thank you very much!
2009-12-18
suzhiyang
Reply instructions:
You may reply publicly to this message via plain-text email
using any one of the following methods:
* Reply to all the recipients using the --to and --cc options:
reply via email
To: pgsql-hackers@postgresql.org
Cc: suzhiyang@gmail.com
Subject: Re: Distinguish view and table problem
In-Reply-To: <200912182357482650255@gmail.com>
* Save the following mbox file, import it into your mail client,
and reply-to-all from there: mbox
This inbox is served by DDX for PostgreSQL; see mirroring instructions
for how to clone and mirror all data and code used for this inbox