X-Original-To: pgsql-php-postgresql.org@localhost.postgresql.org Received: from localhost (unknown [200.46.204.2]) by svr1.postgresql.org (Postfix) with ESMTP id 932FDD1C9FB for ; Sun, 1 Feb 2004 12:41:50 +0000 (GMT) Received: from svr1.postgresql.org ([200.46.204.71]) by localhost (neptune.hub.org [200.46.204.2]) (amavisd-new, port 10024) with ESMTP id 79941-02 for ; Sun, 1 Feb 2004 08:41:33 -0400 (AST) Received: from icfed.net (relay.icfed.net [62.105.156.139]) by svr1.postgresql.org (Postfix) with ESMTP id 5A553D1CCD7 for ; Sun, 1 Feb 2004 08:41:28 -0400 (AST) Received: from [10.0.20.160] (account voodoo@wenet.ru HELO voodoo-book.mshome.net) by icfed.net (CommuniGate Pro SMTP 4.1.8) with ESMTP id 33939 for pgsql-php@postgresql.org; Sun, 01 Feb 2004 15:41:17 +0300 Date: Sun, 1 Feb 2004 15:39:01 +0300 From: Alexander Popkov X-Mailer: The Bat! (v1.62e) Reply-To: Alexander Popkov Organization: MCFR X-Priority: 3 (Normal) Message-ID: <62364058618.20040201153901@wenet.ru> To: pgsql-php@postgresql.org Subject: LOCKing method in my situation? MIME-Version: 1.0 Content-Type: text/plain; charset=us-ascii Content-Transfer-Encoding: 7bit X-Virus-Scanned: by amavisd-new at postgresql.org X-Archive-Number: 200402/1 X-Sequence-Number: 2549 Hello PostgreSQL gurus! I am have question to you. I am have table 'chall_item' in my database. In many PHP scripts i am do 'SELECT * FROM chall_item....', but in one script (join.php) i do a) SELECT COUNT(*) FROM chall_item WHERE chall_no = XXX; b) if returned number less then 10, then i do INSERT INTO chall_item (chall_no, ...) VALUES (XXX, ...); But if beetwen a) and b) other instance of 'join.php' do part "a)" - then odd row are added ;( I can do LOCK TABLE chall_item IN ACCESS EXCLUSIVE MODE, but IMHO this is not true method in this situation, because i need lock only for 'join.php' not for all scripts. Help me plz. Which other methods are exist in this situation. -- Best regards, Alexander mailto:voodoo@wenet.ru