Re: [HACKERS] look up tables while parsing queries

2006-02-06 Thread andrew
On 2/5/06, Neil Conway [EMAIL PROTECTED] wrote:
 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
 guide.

 -Neil

It is not in the raw parser. I meant inside the transformStmt(). What
is friends? Could  you possibly point out at least one place that
illustrates how to access  tables?

Thanks.

--
andrew

---(end of broadcast)---
TIP 6: explain analyze is your friend


Re: [HACKERS] look up tables while parsing queries

2006-02-04 Thread Neil Conway
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
guide.

-Neil



---(end of broadcast)---
TIP 9: In versions below 8.0, the planner will ignore your desire to
   choose an index scan if your joining column's datatypes do not
   match


[HACKERS] look up tables while parsing queries

2006-02-03 Thread andrew
Hi

I am modifying the source code. I want to look up some information
from some tables while parsing the queries. What functions I can use
to look up tables? btw I am using version 7.3. Thanks.

--
andrew

---(end of broadcast)---
TIP 4: Have you searched our list archives?

   http://archives.postgresql.org