Re: killing processes
От | Tom Lane |
---|---|
Тема | Re: killing processes |
Дата | |
Msg-id | 4093.1248146062@sss.pgh.pa.us обсуждение исходный текст |
Ответ на | Re: killing processes (David Kerr <dmk@mr-paradox.net>) |
Ответы |
Re: killing processes
|
Список | pgsql-general |
David Kerr <dmk@mr-paradox.net> writes: > But, i don't see any coded loop or way for me to insert a signal check. (I'm not much of a > programmer) the function was just: > CREATE OR REPLACE FUNCTION array_median(anyarray) > RETURNS anyelement AS > $$ > SELECT CASE > WHEN array_upper($1,1) = 0 THEN null > WHEN mod(array_upper($1,1),2) = 1 THEN > asorted[ceiling(array_upper(asorted,1)/2.0)] > ELSE > ((asorted[ceiling(array_upper(asorted,1)/2.0)] + asorted[ceiling(array_upper(asorted,1)/2.0)+1])/2.0) END > FROM (SELECT ARRAY(SELECT ($1)[n] FROM > generate_series(1, array_upper($1, 1)) AS n > WHERE ($1)[n] IS NOT NULL > ORDER BY ($1)[n] > ) As asorted) As foo ; > $$ > LANGUAGE 'sql' IMMUTABLE; Huh. How big an array were you trying to invoke it on? regards, tom lane
В списке pgsql-general по дате отправления: