pg.ddx.io pgsql-docs@postgresql.org mailing list archivehelp / color / mirror / Atom feed
Creating variable argument user defined functions in C 3+ messages / 2 participants [nested] [flat]
* Creating variable argument user defined functions in C @ 2017-09-18 07:52 athinivas <athinivas@gmail.com> 0 siblings, 1 reply; 3+ messages in thread From: athinivas @ 2017-09-18 07:52 UTC (permalink / raw) To: pgsql-docs Hi, For my project, I need to create a variable argument function which accepts multiple strings & returns some transformed string. I've gone through the https://www.postgresql.org/docs/9.6/static/xfunc-c.html doc..But there's no clear documentation for variable args. I'able to understand we can have ArrayType as data type for same. But how to iterate & process it??? Kindly help. -- Sent from: http://www.postgresql-archive.org/PostgreSQL-docs-f2165602.html -- Sent via pgsql-docs mailing list (pgsql-docs@postgresql.org) To make changes to your subscription: http://www.postgresql.org/mailpref/pgsql-docs ^ permalink raw reply [nested|flat] 3+ messages in thread
* Re: Creating variable argument user defined functions in C @ 2017-09-18 13:41 Tom Lane <tgl@sss.pgh.pa.us> parent: athinivas <athinivas@gmail.com> 0 siblings, 1 reply; 3+ messages in thread From: Tom Lane @ 2017-09-18 13:41 UTC (permalink / raw) To: athinivas <athinivas@gmail.com>; +Cc: pgsql-docs athinivas <athinivas@gmail.com> writes: > For my project, I need to create a variable argument function which accepts > multiple strings & returns some transformed string. I've gone through the > https://www.postgresql.org/docs/9.6/static/xfunc-c.html doc..But there's no > clear documentation for variable args. For ordinary array types the VARIADIC marking makes no difference so far as the function is concerned; you just treat the last argument as a normal array. If you want to do VARIADIC ANY then the rules are different, since the arguments aren't necessarily all the same type and so can't be folded into an array. > I'able to understand we can have ArrayType as data type for same. But how to > iterate & process it??? Kindly help. There's plenty of examples in the core code. For the normal-array case look at anything that takes an array, e.g. json_extract_path. For VARIADIC ANY you might look at concat() or format(). regards, tom lane -- Sent via pgsql-docs mailing list (pgsql-docs@postgresql.org) To make changes to your subscription: http://www.postgresql.org/mailpref/pgsql-docs ^ permalink raw reply [nested|flat] 3+ messages in thread
* Re: Creating variable argument user defined functions in C @ 2017-09-20 15:12 athinivas <athinivas@gmail.com> parent: Tom Lane <tgl@sss.pgh.pa.us> 0 siblings, 0 replies; 3+ messages in thread From: athinivas @ 2017-09-20 15:12 UTC (permalink / raw) To: pgsql-docs Thanks a lot tom lane. -- Sent from: http://www.postgresql-archive.org/PostgreSQL-docs-f2165602.html -- Sent via pgsql-docs mailing list (pgsql-docs@postgresql.org) To make changes to your subscription: http://www.postgresql.org/mailpref/pgsql-docs ^ permalink raw reply [nested|flat] 3+ messages in thread
end of thread, other threads:[~2017-09-20 15:12 UTC | newest] Thread overview: 3+ messages (download: mbox mbox.gz follow: Atom feed) -- links below jump to the message on this page -- 2017-09-18 07:52 Creating variable argument user defined functions in C athinivas <athinivas@gmail.com> 2017-09-18 13:41 ` Tom Lane <tgl@sss.pgh.pa.us> 2017-09-20 15:12 ` athinivas <athinivas@gmail.com>
This inbox is served by DDX for PostgreSQL; see mirroring instructions for how to clone and mirror all data and code used for this inbox