Re: Regex

Поиск
Список
Период
Сортировка
От Tom Lane
Тема Re: Regex
Дата
Msg-id 20759.1097033789@sss.pgh.pa.us
обсуждение исходный текст
Ответ на Regex  (Theo Galanakis <Theo.Galanakis@lonelyplanet.com.au>)
Список pgsql-sql
Theo Galanakis <Theo.Galanakis@lonelyplanet.com.au> 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


В списке pgsql-sql по дате отправления:

Предыдущее
От: sreejith s
Дата:
Сообщение: Database Backup
Следующее
От: Theo Galanakis
Дата:
Сообщение: Re: Regex