Skip site navigation (1) Skip section navigation (2)

proposal: fix corner use case of variadic fuctions usage

From: Pavel Stehule <pavel(dot)stehule(at)gmail(dot)com>
To: PostgreSQL Hackers <pgsql-hackers(at)postgresql(dot)org>
Subject: proposal: fix corner use case of variadic fuctions usage
Date: 2012-11-04 11:49:08
Message-ID: CAFj8pRDZc7wG1ewnmqUWkjDsB78Pu=Oj_WZ8_CS7qJUCKRUNmQ@mail.gmail.com (view raw or flat)
Thread:
Lists: pgsql-generalpgsql-hackers
Hello

here is patch, that enables using a variadic parameter modifier for
variadic "any" function.

Motivation for this patch is consistent behave of "format" function,
but it fixes behave of all this class variadic functions.

postgres=> -- check pass variadic argument
postgres=> select format('%s, %s', variadic array['Hello','World']);
    format
──────────────
 Hello, World
(1 row)

postgres=> -- multidimensional array is supported
postgres=> select format('%s, %s', variadic
array[['Nazdar','Svete'],['Hello','World']]);
            format
───────────────────────────────
 {Nazdar,Svete}, {Hello,World}
(1 row)

It respect Tom's comments - it is based on short-lived FmgrInfo
structures, that are created immediately before function invocation.

Note: there is unsolved issue - reusing transformed arguments - so it
is little bit suboptimal for VARIADIC RETURNING MultiFuncCall
functions, where we don't need to repeat a unpacking of array value.

Regards

Pavel

Attachment: variadic_argument_for_variadic_any_function.diff
Description: application/octet-stream (16.6 KB)

Responses

pgsql-hackers by date

Next:From: Matthew GerberDate: 2012-11-04 18:54:50
Subject: Re: Unresolved error 0xC0000409 on Windows Server
Previous:From: Pavel StehuleDate: 2012-11-04 09:35:45
Subject: Re: RFC: Timing Events

pgsql-general by date

Next:From: Stephen WoodbridgeDate: 2012-11-04 13:57:50
Subject: C SRF question
Previous:From: Xiong HeDate: 2012-11-04 00:43:39
Subject: Re: Server to run Postgresql

Privacy Policy | About PostgreSQL
Copyright © 1996-2014 The PostgreSQL Global Development Group