Обсуждение: tuple concurrently updated
My application receives the folllowing error sometimes.
Any idea how to fix ?
Andrus.
7/XX000:Error while executing the query;ERROR: tuple concurrently updated
CONTEXT: SQL statement "DROP TABLE templsabi"PL/pgSQL function "drop_table"
line 2 at execute statement
SELECT drop_table('templsabi');CREATE TABLE templsabi AS
select
toode,
osak as sihtyksus,
partii,
laosumma,
1 as lj, 0 as st, 0 as vm,
0 as kaubasumma,
kogus,
0 as kogpak,
CAST('' AS CHAR(10)) as yksus,
CAST('' AS CHAR(1)) as doktyyp
from HETKESEI
where true
AND osak LIKE 'TARTU%' ESCAPE '!'
AND toode='DIS123103'
;SELECT * FROM templsabi
drop_table is defined as
CREATE OR REPLACE FUNCTION drop_table(TEXT)
RETURNS VOID STRICT LANGUAGE plpgsql AS $$
BEGIN
EXECUTE 'DROP TABLE ' || $1;
EXCEPTION WHEN UNDEFINED_TABLE THEN
RETURN;
END;
$$;
"Andrus" <kobruleht2@hot.ee> writes:
> My application receives the folllowing error sometimes.
> 7/XX000:Error while executing the query;ERROR: tuple concurrently updated
> CONTEXT: SQL statement "DROP TABLE templsabi"PL/pgSQL function "drop_table"
> line 2 at execute statement
That's a bit interesting ... what PG version is this exactly? What else
might be touching that table at the same time? Do you have autovacuum
enabled?
regards, tom lane
> That's a bit interesting ... what PG version is this exactly? "PostgreSQL 8.1.4 on i686-pc-mingw32, compiled by GCC gcc.exe (GCC) 3.4.2 (mingw-special)" > What else might be touching that table at the same time? Maybe some other client executes same or other command at same time in same database. templsabi table is created, dropped and updated frequently by a number of clients concurrently. > Do you have autovacuum enabled? Yes. Andrus.