Re: proposal sql: labeled function params - Mailing list pgsql-hackers

From Hannu Krosing
Subject Re: proposal sql: labeled function params
Date
Msg-id 1218828284.7387.17.camel@huvostro
Whole thread Raw
In response to Re: proposal sql: labeled function params  ("Pavel Stehule" <pavel.stehule@gmail.com>)
Responses Re: proposal sql: labeled function params
List pgsql-hackers
On Fri, 2008-08-15 at 14:54 +0200, Pavel Stehule wrote:
> 2008/8/15 Peter Eisentraut <peter_e@gmx.net>:
> > Am Thursday, 14. August 2008 schrieb Pavel Stehule:
> >> I propose enhance current syntax that allows to specify label for any
> >> function parameter:
> >>
> >> fcename(expr [as label], ...)
> >> fcename(colname, ...)
> >>
> >> I would to allow  same behave of custom functions like xmlforest function:
> >> postgres=# select xmlforest(a) from foo;
> >>  xmlforest
> >> -----------
> >>  <a>10</a>
> >> (1 row)
> >
> > Do you have a use case for this outside of XML?
> >
> 
> JSON and similar (custom) protocols

why not use a format string, or any other separate (sub)language ?

select json('[name:$1, age: $2]', name, age) from students;

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



pgsql-hackers by date:

Previous
From: Bruce Momjian
Date:
Subject: Re: Automatic Client Failover
Next
From: Tom Lane
Date:
Subject: Re: Mini improvement: statement_cost_limit