Distinguish view and table problem - Mailing list pgsql-hackers

From suzhiyang
Subject Distinguish view and table problem
Date
Msg-id 200912182357482650255@gmail.com
Whole thread Raw
Responses Re: Distinguish view and table problem  (Filip Rembiałkowski <plk.zuber@gmail.com>)
Re: Distinguish view and table problem  (Robert Haas <robertmhaas@gmail.com>)
Re: Distinguish view and table problem  (Tom Lane <tgl@sss.pgh.pa.us>)
List pgsql-hackers
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

pgsql-hackers by date:

Previous
From: Nicolas Barbier
Date:
Subject: Re: Update on true serializable techniques in MVCC
Next
From: Filip Rembiałkowski
Date:
Subject: Re: Distinguish view and table problem