WITH clause

Поиск
Список
Период
Сортировка
От David Fetter
Тема WITH clause
Дата
Msg-id 20031212181356.GV1859@fetter.org
обсуждение исходный текст
Ответы Re: WITH clause  (Peter Eisentraut <peter_e@gmx.net>)
Re: WITH clause  (Tom Lane <tgl@sss.pgh.pa.us>)
Re: WITH clause  (Alvaro Herrera Munoz <alvherre@dcc.uchile.cl>)
Re: WITH clause  (Hannu Krosing <hannu@tm.ee>)
Список pgsql-hackers
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];

Here res[1] would be the whole pattern match, res[2] & res[3] would be
the set of digits before x and the set of digits after x,
respectively.

Ideally, there could also be (optionally) res[pre] and res[post] which
would refer to the stuff in foo that preceds the match and stuff in
foo that follows the match, respectively.

Perl weenies may think of $&, $1, ... $n, $` and $'.

Comments, ideas, brickbats, and "you're on crack" comments welcome. :)

Cheers,
D
-- 
David Fetter david@fetter.org http://fetter.org/
phone: +1 510 893 6100    cell: +1 415 235 3778


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

Предыдущее
От: Tom Lane
Дата:
Сообщение: Re: Use of 'cp -r' in CREATE DATABASE
Следующее
От: Peter Eisentraut
Дата:
Сообщение: Re: WITH clause