Re: user defined function

From: Tom Lane <tgl(at)sss(dot)pgh(dot)pa(dot)us>
To: Richard Huxton <dev(at)archonet(dot)com>
Cc: Yl Zhou <andrew(dot)ylzhou(at)gmail(dot)com>, pgsql-general(at)postgresql(dot)org
Subject: Re: user defined function
Date: 2006-01-24 15:56:40
Message-ID: 19162.1138118200@sss.pgh.pa.us
Views: Raw Message | Whole Thread | Download mbox | Resend email
Thread:
Lists: pgsql-general

Richard Huxton <dev(at)archonet(dot)com> writes:
> Tom Lane wrote:
>> You could do that in C, but none of the available PLs support it.

> How would you define the signature for the function? One parameter of
> type anyelement?

Type RECORD would be a better choice --- ANYELEMENT allows scalar types
which is not what you want here. (You could probably still do it with
a function declared that way, but it'd have to take extra steps to
defend itself against being passed, say, an integer.)

If you're looking for a coding model, stripping down record_out() to
just count nulls should get you there.

regards, tom lane

In response to

Responses

Browse pgsql-general by date

  From Date Subject
Next Message Tom Lane 2006-01-24 15:58:47 Re:
Previous Message Magnus Hagander 2006-01-24 15:45:16 Re: Does this look ethical to you?