From: Tatsuo Ishii on 26 May 2010 21:02 I'm thinking about exporting the raw parser and related modules as a C library. Though this will not be an immediate benefit of PostgreSQL itself, it will be a huge benefit for any PostgreSQL applications/middle ware those need to parse SQL statements. For example, pgpool-II parses queries to know if it's a read query or not. In other case, it needs to know if a SELECT statement includes any temporal constructor such as CURRENT_TIME_STAMP. These are not a trivial job since SQL grammar is complex. For this purpose pgpool-II copies PostgreSQL parser code and use it. Of course maintaining the part is pain since PostgreSQL's parser will be changed from release to release. I believe not only pgpool-II but some connection pooling middle wares need SQL parser as well(pgbouncer?). Also any tool which accepts SQL statement as its input would also need SQL parser(pgAdmin?). For them exported raw parser will be a huge benefit. The implementation will not be very difficult since pgpool-II has already done most of necessary work for this: - extract raw parser part from parser directory, which include gram.y, scan.l and keywords.c - extract utility functions needed to handle raw parse tree: nodes/nodes.c makefunc.c etc. - create an exportable version of memory manager - create an exportable exception handling routines(i.e. elog) - wrap all of above into a libXX*.so I think those works are essentially a refactoring of existing raw parser, and will not add performance degration nor maintenance cost. Comments? -- Tatsuo Ishii SRA OSS, Inc. Japan English: http://www.sraoss.co.jp/index_en.php Japanese: http://www.sraoss.co.jp -- Sent via pgsql-hackers mailing list (pgsql-hackers(a)postgresql.org) To make changes to your subscription: http://www.postgresql.org/mailpref/pgsql-hackers
|
Pages: 1 Prev: Distclean does not remove gram.c Next: exporting raw parser |