Re: function_name.parameter_name
От | Darren Duncan |
---|---|
Тема | Re: function_name.parameter_name |
Дата | |
Msg-id | 4C87E14F.3000906@darrenduncan.net обсуждение исходный текст |
Ответ на | Re: function_name.parameter_name (Bruce Momjian <bruce@momjian.us>) |
Ответы |
Re: function_name.parameter_name
|
Список | pgsql-hackers |
Bruce Momjian wrote: > Sergey Konoplev wrote: >> 1. >> CREATE FUNCTION func_name(arg_name text) RETURNS integer AS $$ >> BEGIN >> RAISE INFO '%', func_name.arg_name; >> ... >> >> 2. >> CREATE FUNCTION func_name() RETURNS integer AS $$ >> DECLARE >> var_name text := 'bla'; >> BEGIN >> RAISE INFO '%', func_name.var_name; >> ... >> >> 3. >> CREATE FUNCTION func_very_very_very_very_long_name() RETURNS integer AS $$ >> << func_alias >> >> DECLARE >> var_name text := 'bla'; >> BEGIN >> RAISE INFO '%', func_alias.var_name; >> ... I suggest that it might be reasonable to introduce a new syntax, that isn't already valid for something inside a routine, and use that as a terse way to reference the current function and/or its parameters. This may best be a simple constant syntax. For example, iff it isn't already valid for a qualified name to have a leading period/full-stop/radix-marker, then this could be introduced as a valid way to refer to the current routine. Then in the above examples you can say: RAISE INFO '%', .arg_name; RAISE INFO '%', .var_name; ... without explicitly declaring a func_alias. In a tangent, you can also use a new constant syntax (unless you have one?) to allow a routine to invoke itself without knowing its own name, which could be nice in a simple recursive routine. Maybe ".(arg,arg)" would do it? I would think this should be non-intrusive and useful and could go in 9.1. -- Darren Duncan
В списке pgsql-hackers по дате отправления: