Re: Initial review of xslt with no limits patch
От | David E. Wheeler |
---|---|
Тема | Re: Initial review of xslt with no limits patch |
Дата | |
Msg-id | F6316F64-BB7D-4B4C-8684-99D7E6673F53@kineticode.com обсуждение исходный текст |
Ответ на | Re: Initial review of xslt with no limits patch (Pavel Stehule <pavel.stehule@gmail.com>) |
Ответы |
Re: Initial review of xslt with no limits patch
|
Список | pgsql-hackers |
On Aug 6, 2010, at 1:49 PM, Pavel Stehule wrote: > yes it is one a possibility and probably best. The nice of this > variant can be two forms like current variadic does - foo(.., a := > 10, b := 10) or foo(.., variadic ARRAY[(a,10),(b,10)]) I started fiddling and got as far as this: CREATE TYPE pair AS ( key text, val text ); CREATE OR REPLACE FUNCTION pair(anyelement, anyelement) RETURNS pair LANGUAGE SQL AS $$ SELECT ROW($1, $2)::pair; $$; CREATE OR REPLACE FUNCTION pair(text, text) RETURNS pair LANGUAGE SQL AS $$ SELECT ROW($1, $2)::pair; $$; CREATE OPERATOR ~> (LEFTARG = anyelement,RIGHTARG = anyelement,PROCEDURE = pair ); CREATE OPERATOR ~> (LEFTARG = text,RIGHTARG = text,PROCEDURE = pair ); CREATE OR REPLACE FUNCTION foo(variadic pair[]) RETURNS SETOF text LANGUAGE SQL AS $$ -- SELECT unnest($1)::text SELECT $1[1].key UNION SELECT $1[1].val UNION SELECT $1[2].key UNION SELECT $1[2].val; $$; SELECT foo('this' ~> 'that', 1 ~> 4); Not bad, I think. I kind of like it. It reminds me how much I hate the % hstore construction operator, though (the new namefor =>). Best, David
В списке pgsql-hackers по дате отправления: