Re: WIP: default values for function parameters - Mailing list pgsql-hackers

From Robert Haas
Subject Re: WIP: default values for function parameters
Date
Msg-id 603c8f070812131742w31dc7372oca6b7c4f23c0e936@mail.gmail.com
Whole thread Raw
In response to Re: WIP: default values for function parameters  (Dimitri Fontaine <dfontaine@hi-media.com>)
Responses Re: WIP: default values for function parameters
List pgsql-hackers
> What if relabeling support were to spread some more?

The only example I can think of besides XML is JSON.  There might be a
few more.  Basically, relabelling is a handy shortcut when you are
serializing data and want to avoid specifying a list of columns and an
(almost) identical list of labels.  Otherwise, it's not good for much.I think we should eventually aim to support
user-definedfunctions
 
that work like this, because people will forever be inventing new ways
to serialize things and it'd be nice not to have to recompile to add
support for a new one.

I suppose you might want to do something like this:

html_input(foo) returns <input name='foo' type='text' value='[...value
of foo...]'>
html_input(foo AS bar) returns <input name='foo' type='text'
value='[...value of foo...]'>
html_input(foo, type: hidden) returns <input name='foo' type='hidden'
value='[...value of foo...]'>

...Robert


pgsql-hackers by date:

Previous
From: "Joshua D. Drake"
Date:
Subject: Re: Future request: BgBouncer && "cache lookup failed for function": Auto recache function.
Next
From: "Greg Stark"
Date:
Subject: Re: WIP: default values for function parameters