Re: plpgsql: function throws error on second call!

Поиск
Список
Период
Сортировка
От Stephan Szabo
Тема Re: plpgsql: function throws error on second call!
Дата
Msg-id 20020726104029.G60864-100000@megazone23.bigpanda.com
обсуждение исходный текст
Ответ на plpgsql: function throws error on second call!  (Janning Vygen <vygen@gmx.de>)
Ответы Re: plpgsql: function throws error on second call!  (Janning Vygen <vygen@gmx.de>)
Список pgsql-general
On Fri, 26 Jul 2002, Janning Vygen wrote:

> i cant get it right on my own. i ve tried to find something in the
> bug reports and there was a bug with temp tables in functions years
> ago. but it was fixed..
>
> so here s my problem:
>
> CREATE FUNCTION testpunkte (int4) RETURNS int4 AS '
>   DECLARE
>     var_id ALIAS FOR $1;
>     var_count int4 := 0;
>   BEGIN
>
>     CREATE TEMP TABLE temp_punkte AS
>     SELECT * FROM tmp where id = var_id;
>
>    UPDATE real
>    SET    val1 = temp_punkte.val1
>    WHERE  id   = temp_punkte.id;
>    GET DIAGNOSTICS var_count = ROW_COUNT;
>    DROP TABLE temp_punkte;
>
>    RETURN var_count;
>    END;
> ' language 'plpgsql';

If you're going to create/drop a table in a function,
you'll want to use execute any time you're working with the
table, otherwise it'll cache the plan from the original table
that you've dropped.


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

Предыдущее
От: "Marc G. Fournier"
Дата:
Сообщение: Re: Bad HTML in Mail List Archives
Следующее
От: Patrick Nelson
Дата:
Сообщение: Import csv