plpgsql: function throws error on second call!
От | Janning Vygen |
---|---|
Тема | plpgsql: function throws error on second call! |
Дата | |
Msg-id | 200207261727.g6QHR1M03244@janning.planwerk6.local обсуждение исходный текст |
Ответы |
Re: plpgsql: function throws error on second call!
|
Список | pgsql-general |
hi, 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'; it is just a dummy function on some testdata in my testdatabase but if i call it two times: testarea=# select testpunkte(1); testpunkte ------------ 1 (1 row) fisrt time is fine and second time: testarea=# select testpunkte(1); NOTICE: Error occurred while executing PL/pgSQL function testpunkte NOTICE: line 9 at SQL statement ERROR: Relation 7842984 does not exist it seems to me the temp table is not generated in the second call of the function. but i dont know anything about system tables and so on so i cant check it. any hints or am i just stupid and dont see a typo?? but if the function makes it right on the first call it cant be a typo. hmm. looks strange to me. can anybody give me small hint, please? kind regards janning
В списке pgsql-general по дате отправления: