Re: WITH clause

Поиск
Список
Период
Сортировка
От Hannu Krosing
Тема Re: WITH clause
Дата
Msg-id 1071349138.2430.7.camel@fuji.krosing.net
обсуждение исходный текст
Ответ на WITH clause  (David Fetter <david@fetter.org>)
Ответы Re: WITH clause  (David Fetter <david@fetter.org>)
Re: WITH clause  (Greg Stark <gsstark@mit.edu>)
Список pgsql-hackers
David Fetter kirjutas R, 12.12.2003 kell 20:13:
> Kind people,
> 
> I'm looking to the SQL WITH clause as a way to get better regex
> support in PostgreSQL.  I've been chatting a little bit about this,
> and here's an idea for a behavior.  Implementation details TBD.
> 
> WITH res = match (x.foo, '([0-9]+)x([0-9]+)')
> SELECT *
> FROM x
> WHERE y = res[2]
> OR    y = res[3];

why not use current standard syntax

SELECT x.* FROM x,     (select match (x.foo, '([0-9]+)x([0-9]+)')       from x innerx      where innerx.pk = x.pk
)as res
 
HAVING y = get_match_group(res, 2)   OR y = get_match_group(res, 3)
;

with functions match(str,regex) which returns a match object
and get_match_group which extracts matched groups from it.

---------------
Hannu



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

Предыдущее
От: Dennis Bjorklund
Дата:
Сообщение: Re: WITH clause
Следующее
От: David Fetter
Дата:
Сообщение: Re: WITH clause