X-Original-To: pgsql-sql-postgresql.org@localhost.postgresql.org Received: from localhost (unknown [200.46.204.144]) by svr1.postgresql.org (Postfix) with ESMTP id AD6BF32A77A for ; Sun, 3 Oct 2004 11:56:59 +0100 (BST) Received: from svr1.postgresql.org ([200.46.204.71]) by localhost (av.hub.org [200.46.204.144]) (amavisd-new, port 10024) with ESMTP id 29519-03 for ; Sun, 3 Oct 2004 10:56:52 +0000 (GMT) Received: from av1-2-sn4.m-sp.skanova.net (av1-2-sn4.m-sp.skanova.net [81.228.10.115]) by svr1.postgresql.org (Postfix) with ESMTP id 5B60032A777 for ; Sun, 3 Oct 2004 11:56:53 +0100 (BST) Received: by av1-2-sn4.m-sp.skanova.net (Postfix, from userid 502) id 2C89237FB4; Sun, 3 Oct 2004 12:56:52 +0200 (CEST) Received: from smtp2-2-sn4.m-sp.skanova.net (smtp2-2-sn4.m-sp.skanova.net [81.228.10.182]) by av1-2-sn4.m-sp.skanova.net (Postfix) with ESMTP id 1F83F37E48 for ; Sun, 3 Oct 2004 12:56:52 +0200 (CEST) Received: from [192.168.100.2] (h153n2fls31o806.telia.com [217.210.1.153]) by smtp2-2-sn4.m-sp.skanova.net (Postfix) with ESMTP id 10D3537E42 for ; Sun, 3 Oct 2004 12:56:51 +0200 (CEST) Subject: Concurrency problem From: Dag Gullberg To: pgsql-sql@postgresql.org Content-Type: text/plain Organization: Message-Id: <1096801131.5238.32.camel@hemma> Mime-Version: 1.0 X-Mailer: Ximian Evolution 1.2.2 (1.2.2-5) Date: 03 Oct 2004 12:58:52 +0200 Content-Transfer-Encoding: 7bit X-Virus-Scanned: by amavisd-new at hub.org X-Spam-Status: No, hits=0.0 tagged_above=0.0 required=5.0 tests= X-Spam-Level: X-Archive-Number: 200410/7 X-Sequence-Number: 19110 Hi, I have a problem with concurrency, where ordinary selects render me Warning: pg_query(): Query failed: ERROR: tuple concurrently updated CONTEXT: PL/pgSQL function "get_rights" line 5 at SQL statement in /home/site/PHP/db_func.php on line 301 Code of get_rights: GRANT SELECT ON c.users TO adm,w3; SELECT rights INTO result FROM c.users WHERE usr_id=uid; REVOKE ALL ON c.users FROM w3,adm; RETURN result; What function is in error at a specific point in time appears to be random. There are no "update" SQL commands issued between two loads (actually two meny selections in sequence, the first not being served completely). Still the db complain about "updates". I use triggers only at "create" and in some instances "update", not when doing "select". Tables are interconnected by foreign keys, sometimes mutliple. Is there anybody out there with similar experiences? Someone who might point in some directions in terms of documentation of *how* to design and use a database to avoid concurrency problems? Any thoughts on this are greatly appreciated. /Dag