plpgsql function parameter questions

Поиск
Список
Период
Сортировка
Искать

plpgsql function parameter questions

От:
"augie" <augie@bravurasystems.com>
Дата:
these 2 questions are actually unrelated...

1.  what version of pg do i need to go to in order to eliminate the '16
parameter maximum' restraint?

2.  can i pass an array of integers to a function?  can i return an array of
integers?  if so, what would the function definition look like?

thanks

greg




Re: plpgsql function parameter questions

От:
Bruce Momjian <pgman@candle.pha.pa.us>
Дата:

I think 7.0 or 7.1.  Not sure.

> these 2 questions are actually unrelated...
> 
> 1.  what version of pg do i need to go to in order to eliminate the '16
> parameter maximum' restraint?
> 
> 2.  can i pass an array of integers to a function?  can i return an array of
> integers?  if so, what would the function definition look like?
> 
> thanks
> 
> greg
> 
> 
> 
> 
> 
> ---------------------------(end of broadcast)---------------------------
> TIP 6: Have you searched our list archives?
> 
> http://www.postgresql.org/search.mpl
> 

-- 
  Bruce Momjian                        |  http://candle.pha.pa.us
  pgman@candle.pha.pa.us               |  (610) 853-3000
  +  If your life is a hard drive,     |  830 Blythe Avenue
  +  Christ can be your backup.        |  Drexel Hill, Pennsylvania 19026

Re: plpgsql function parameter questions

От:
Tom Lane <tgl@sss.pgh.pa.us>
Дата:
>> 1.  what version of pg do i need to go to in order to eliminate the '16
>> parameter maximum' restraint?

Build your own version with a suitable value of FUNC_MAX_ARGS (a/k/a
INDEX_MAX_KEYS) in src/include/config.h.

>> 2.  can i pass an array of integers to a function?  can i return an array of
>> integers?  if so, what would the function definition look like?

test71=# create function foo (integer[]) returns integer[] as '
test71'# begin
test71'# return $1;
test71'# end;' language 'plpgsql';
CREATE
test71=# select foo('{1,2,3}');
   foo
---------
 {1,2,3}
(1 row)

Actually doing any serious manipulation of an array in plpgsql might be
tricky, however.  In particular, I don't see any simple way to construct
an array value from scratch.  You might have better luck with pltcl.
There are examples of array-value manipulation in pltcl's self-test, IIRC.

			regards, tom lane
FAQ