WITH clause
От | David Fetter |
---|---|
Тема | WITH clause |
Дата | |
Msg-id | 20031212181356.GV1859@fetter.org обсуждение исходный текст |
Ответы |
Re: WITH clause
Re: WITH clause Re: WITH clause Re: WITH clause |
Список | 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 по дате отправления: