Calling PL functions with named parameters

Поиск
Список
Период
Сортировка
От David Fetter
Тема Calling PL functions with named parameters
Дата
Msg-id 20040813214148.GD17886@fetter.org
обсуждение исходный текст
Ответы Re: Calling PL functions with named parameters  (Tom Lane <tgl@sss.pgh.pa.us>)
Re: Calling PL functions with named parameters  (Oliver Jowett <oliver@opencloud.com>)
Re: Calling PL functions with named parameters  ("Jim C. Nasby" <decibel@decibel.org>)
Re: Calling PL functions with named parameters  (Peter Eisentraut <peter_e@gmx.net>)
Список pgsql-hackers
Kind people,

I've brought this up before, and with Dennis Bjőrklund's help, would
like to bring it up again.  Here's the idea:

I'd like to be able to create functions with named parameters that
could be called with the names in any order.  For example,

CREATE OR REPLACE FUNCTION foo_func(name TEXT, val INTEGER) AS ...

SELECT foo_func(val AS 23, name AS 'Name goes here');

and have it Do The Right Thing.

Dennis has pointed out that mixing the call-with-named-parameter
interface with call-by-order-of-parameters one would cause confusion,
and I think it would be OK to disallow this type mixing, so

SELECT foo_func(name AS 'yet another name', 35);

would be disallowed.

A calling convention that names parameters makes it a lot easier to
track just exactly what parameter is set to which value, and lets
people not have to memorize what order those named parameters appear
in.  On a related note, it would also be nice to have default
parameters and some way to say to use them.

Well, that's my thoughts so far.  What are yours?

Cheers,
D
-- 
David Fetter david@fetter.org http://fetter.org/
phone: +1 510 893 6100   mobile: +1 415 235 3778

Remember to vote!


В списке pgsql-hackers по дате отправления:

Предыдущее
От: Tom Lane
Дата:
Сообщение: Re: PostgreSQL 8.0.0beta1 and diet libc
Следующее
От: Tom Lane
Дата:
Сообщение: Re: hot spare / log shipping work on