Re: WIP: default values for function parameters

From: "Robert Haas" <robertmhaas(at)gmail(dot)com>
To: "Dimitri Fontaine" <dfontaine(at)hi-media(dot)com>
Cc: "Tom Lane" <tgl(at)sss(dot)pgh(dot)pa(dot)us>, "Peter Eisentraut" <peter_e(at)gmx(dot)net>, pgsql-hackers(at)postgresql(dot)org, "Michael Meskes" <meskes(at)postgresql(dot)org>, "David E(dot) Wheeler" <david(at)kineticode(dot)com>, "Pavel Stehule" <pavel(dot)stehule(at)gmail(dot)com>, "Heikki Linnakangas" <heikki(dot)linnakangas(at)enterprisedb(dot)com>, "Bruce Momjian" <bruce(at)momjian(dot)us>, "Gregory Stark" <stark(at)enterprisedb(dot)com>, "Grzegorz Jaskiewicz" <gj(at)pointblue(dot)com(dot)pl>
Subject: Re: WIP: default values for function parameters
Date: 2008-12-14 01:42:58
Message-ID: 603c8f070812131742w31dc7372oca6b7c4f23c0e936@mail.gmail.com
Views: Raw Message | Whole Thread | Download mbox | Resend email
Thread:
Lists: 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-defined functions
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

In response to

Responses

Browse pgsql-hackers by date

  From Date Subject
Next Message Greg Stark 2008-12-14 02:21:56 Re: WIP: default values for function parameters
Previous Message Joshua D. Drake 2008-12-14 01:24:13 Re: Future request: BgBouncer && "cache lookup failed for function": Auto recache function.