Hi, Having a query string, I am trying to use the postgres parser to find which relations the query accesses. This is what I currently have:
const char *query_string="select * from dummytable;"; List *parsetree_list=pg_parse_query(query_string); ListCell *parsetree_item; foreach(parsetree_item,parsetree_list){ RawStmt *parsetree=lfirst_node(RawStmt,parsetree_item); Query *query=parse_analyze(parsetree,query_string,NULL,0,NULL); } However, when I inspect the variable "query", it is not populated correctly. For example, commandType is set to CMD_DELETE while I have passed a SELECT query. - What am I doing wrong? - Once I get the query correctly, how can I get the list of relations it gets access to? - Or any other ways to get the list of relations from raw query string through postgres calls? Thank you!