Theo Galanakis <[EMAIL PROTECTED]> writes:
> Basically the regex should return TABLEA, TABLEB from:

> Select * 
> from TABLEA
> Inner jon TABLEB on tableb.columna = tablea.columna

You realize of course that this problem is mathematically impossible?
Regexes are less powerful than context-free grammars, and so it is a
certainty that there exist legal SQL statements that will fool any regex
that you invent for this purpose.

If you know that the SQL statements are coming from a query generator
that produces only a certain style of SQL code, then you might be able
to come up with a solution that works reliably for the output of that
query generator.  But I wonder if you wouldn't be better off bypassing
the parse-and-deparse hacking and tapping directly into the query
generator.

                        regards, tom lane

---------------------------(end of broadcast)---------------------------
TIP 5: Have you checked our extensive FAQ?

               http://www.postgresql.org/docs/faqs/FAQ.html

Reply via email to