Re: Variadic polymorpic functions

From: Vincenzo Romano <vincenzo(dot)romano(at)notorand(dot)it>
To: Pavel Stehule <pavel(dot)stehule(at)gmail(dot)com>
Cc: Tom Lane <tgl(at)sss(dot)pgh(dot)pa(dot)us>, PostgreSQL General <pgsql-general(at)postgresql(dot)org>
Subject: Re: Variadic polymorpic functions
Date: 2010-01-25 08:48:31
Message-ID: 3eff28921001250048n3d40cdb2v4ce367eef163e5eb@mail.gmail.com
Views: Raw Message | Whole Thread | Download mbox | Resend email
Thread:
Lists: pgsql-general

2010/1/25 Pavel Stehule <pavel(dot)stehule(at)gmail(dot)com>:
> 2010/1/25 Vincenzo Romano <vincenzo(dot)romano(at)notorand(dot)it>:
>> 2010/1/23 Pavel Stehule <pavel(dot)stehule(at)gmail(dot)com>:
>>> 2010/1/22 Vincenzo Romano <vincenzo(dot)romano(at)notorand(dot)it>:
>>>> 2010/1/22 Tom Lane <tgl(at)sss(dot)pgh(dot)pa(dot)us>:
>>>>> Vincenzo Romano <vincenzo(dot)romano(at)notorand(dot)it> writes:
>>>>>> 2010/1/22 Tom Lane <tgl(at)sss(dot)pgh(dot)pa(dot)us>:
>>>>>>> regression=# CREATE FUNCTION q( fmt text, variadic args "any" )
>>>>>
>>>>>> And this would allow for a stdarg-like argument list?
>>>>>
>>>>> Yeah, it should work, given suitable C code.
>>>>
>>>> Great!
>>>>
>>>
>>> I wrote this function year ago.
>>>
>>> look on content
>>>
>>> http://pgfoundry.org/projects/pstcollection/
>>
>> Pavel,
>> that format() function should be included into official contribs.
>> What about HOWTO compile?
>
> There are not consensus about final semantic - some people prefer
> sprintf like, some others PostgreSQL RAISE NOTICE like.

Whatever you prefer would be OK as far as it is documented.
In my opinion, the main usage for such a function is in the dynamic SQL code
generation in PL/PgSQL functions:

EXECUTE pst.format( .... );

In this very case the sprintf-like syntax/semantics would be much more
powerful, but
the current one is OK if you think that there's nothing similar at the moment.

Again, this function looks to be a badly missing one and including it
at least into the
default contrib collection would help a lot of users.

--
Vincenzo Romano
NotOrAnd Information Technologies
NON QVIETIS MARIBVS NAVTA PERITVS

In response to

Responses

Browse pgsql-general by date

  From Date Subject
Next Message Jayadevan M 2010-01-25 09:05:07 Re: Slow Query / Check Point Segments
Previous Message Scott Marlowe 2010-01-25 08:15:07 Re: Questions about connection clean-up and "invalid page header"