X-Original-To: pgsql-sql-postgresql.org@localhost.postgresql.org Received: from localhost (unknown [64.117.224.130]) by svr1.postgresql.org (Postfix) with ESMTP id 4F56ED1B518 for ; Thu, 18 Sep 2003 18:24:37 +0000 (GMT) Received: from svr1.postgresql.org ([64.117.224.193]) by localhost (neptune.hub.org [64.117.224.130]) (amavisd-new, port 10024) with ESMTP id 23490-10 for ; Thu, 18 Sep 2003 15:24:27 -0300 (ADT) Received: from megazone.bigpanda.com (megazone.bigpanda.com [64.147.171.210]) by svr1.postgresql.org (Postfix) with ESMTP id 441D2D1B509 for ; Thu, 18 Sep 2003 15:24:26 -0300 (ADT) Received: by megazone.bigpanda.com (Postfix, from userid 1001) id C0F543523E; Thu, 18 Sep 2003 11:24:26 -0700 (PDT) Received: from localhost (localhost [127.0.0.1]) by megazone.bigpanda.com (Postfix) with ESMTP id BF79335227; Thu, 18 Sep 2003 11:24:26 -0700 (PDT) Date: Thu, 18 Sep 2003 11:24:26 -0700 (PDT) From: Stephan Szabo To: tom baker Cc: pgsql-sql@postgresql.org Subject: Re: transaction locking In-Reply-To: <200309181111.42992.postgres@atoka-software.com> Message-ID: <20030918112013.O69397@megazone.bigpanda.com> References: <200309172207.09134.postgres@atoka-software.com> <20030917223104.D58881@megazone.bigpanda.com> <200309181111.42992.postgres@atoka-software.com> MIME-Version: 1.0 Content-Type: TEXT/PLAIN; charset=US-ASCII X-Virus-Scanned: by amavisd-new at postgresql.org X-Archive-Number: 200309/176 X-Sequence-Number: 15154 On Thu, 18 Sep 2003, tom baker wrote: > ah, yes, i DID not see the NOT. that is fixed. here is the code that is having > problems (paired down; all error checking has been removed!) > > $res=pg_query( "BEGIN TRANSACTION" ) ; > > $sql = "LOCK TABLE parts IN SHARE ROW EXCLUSIVE MODE" ; > $res = pg_query( $sql ) ; > > $sql = "SET CONSTRAINTS ALL DEFERRED" ; > $res = pg_query( $sql ) ; > > if ( $amc_part_no == "" ) > { > $sql = "SELECT max(amc_part_no) FROM parts WHERE amc_part_no like 'G%'" ; > $res = pg_query( $sql ) ; > $amc_part_no = pg_fetch_result( $res , 0 , 0 ) ; > # and generate the next part number... > } > > $res = pg_query( $sql ) ; > > $sql = "INSERT INTO parts VALUES ( '".$make."', '".$amc_part_no."', > '".$group_no."', '".$subgroup_no."', '".$part_name."', '".$description."', > '".$prim_grp."', '".$prim_sbg."', '".$no_req."', '".$weight."', > '".$graphic."' )" ; > $res = pg_query( $sql ) ; > > if ( ( $alt_group > "" ) ) > { > $sql = "INSERT INTO part_group ( make, amc_part_no, group_no ) VALUES ( > '$make' , '$amc_part_no' , '$alt_group' ) " ; > $res = pg_query( $sql ) ; > } > > $sql = "INSERT INTO application VALUES ( '$make','$amc_part_no','$tyears', > '$Amodel' )" ; > $res = pg_query( $sql ) ; Can you print out the queries you think you're sending and turn on query logging and see what the database things? Inserting only the first three columns into parts and then a matching application row doesn't seem to fail for me in 7.3.4 or 7.4 beta 1.