Skip site navigation (1) Skip section navigation (2)

Re: look up tables while parsing queries

From: Neil Conway <neilc(at)samurai(dot)com>
To: andrew <andrew(dot)ylzhou(at)gmail(dot)com>
Cc: pgsql-hackers(at)postgresql(dot)org
Subject: Re: look up tables while parsing queries
Date: 2006-02-05 02:21:27
Message-ID: 1139106087.9135.13.camel@localhost.localdomain (view raw, whole thread or download thread mbox)
Lists: pgsql-hackers
On Fri, 2006-02-03 at 10:46 +0100, andrew wrote:
> I am modifying the source code. I want to look up some information
> from some tables while parsing the queries.

If you're referring to the raw parser (parser/gram.y), you should not
attempt to access any tables. For one thing, the raw parser might be
invoked outside a transaction. The statement might also refer to a table
created earlier in the same query string, which would mean the
referenced table would not exist when the latter part of the query
string is parsed.

Instead, database access should be done in the analysis phase -- see
transformStmt() in parser/analyze.c and friends. There are plenty of
examples in the code of how to access tables, which should be a helpful


In response to


pgsql-hackers by date

Next:From: uwcssaDate: 2006-02-05 05:06:55
Subject: postgresql bug?
Previous:From: Devrim GUNDUZDate: 2006-02-05 02:04:09
Subject: About PgPool Global Development Group

Privacy Policy | About PostgreSQL
Copyright © 1996-2018 The PostgreSQL Global Development Group