Re: Initial review of xslt with no limits patch

From: "David E(dot) Wheeler" <david(at)kineticode(dot)com>
To: Pavel Stehule <pavel(dot)stehule(at)gmail(dot)com>
Cc: Tom Lane <tgl(at)sss(dot)pgh(dot)pa(dot)us>, Robert Haas <robertmhaas(at)gmail(dot)com>, Andrew Dunstan <andrew(at)dunslane(dot)net>, Mike Fowler <mike(at)mlfowler(dot)com>, pgsql-hackers(at)postgresql(dot)org
Subject: Re: Initial review of xslt with no limits patch
Date: 2010-08-07 05:20:57
Message-ID: 6C783A4D-A729-44B5-97D5-1A5192F70961@kineticode.com
Views: Raw Message | Whole Thread | Download mbox | Resend email
Thread:
Lists: pgsql-hackers

On Aug 6, 2010, at 10:15 PM, Pavel Stehule wrote:

>> This is not exactly without precedent, either: our built-in xpath()
>> function appears to use precisely this approach for its namespace-list
>> argument.
>
> it's one variant, but isn't perfect
>
> a) it expects so key and value are literals

Huh? You can select into an array:

try=# create table foo(k text, v text);
CREATE TABLE
try=# insert into foo values ('foo', 'bar'), ('baz', 'yow');
INSERT 0 2
try=# select ARRAY[k,v] FROM foo;
array
-----------
{foo,bar}
{baz,yow}
(2 rows)

try=# select ARRAY(SELECT ARRAY[k,v] FROM foo);
ERROR: could not find array type for datatype text[]

Okay, so nested arrays are harder.

> b) it expects so all values has same types - what is usually what we
> need, but not necessary

The XML interface converts them all to text anyway, no?

> c) isn't too readable - I am sorry so I am repeating - it is same
> reason, why people will prefer a VARIADIC function before function
> with array - but I can accept, so this is my view of world

I agree that it's not as sugary as pairs would be. But I admit to having no problem with

SELECT foo(ARRAY[ ['foo', 'bar'], ['baz', 'yow']]);

But maybe I'm biased, since there's a lot of that sort of syntax in pgTAP.

Best,

David

In response to

Responses

Browse pgsql-hackers by date

  From Date Subject
Next Message Pavel Stehule 2010-08-07 05:21:15 Re: Initial review of xslt with no limits patch
Previous Message David E. Wheeler 2010-08-07 05:16:06 Re: Initial review of xslt with no limits patch