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 DABD3D1B4E8 for ; Thu, 18 Sep 2003 23:22:15 +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 89964-05 for ; Thu, 18 Sep 2003 20:22:08 -0300 (ADT) Received: from atoka-software.com (mesozoic.atoka-software.com [64.81.65.30]) by svr1.postgresql.org (Postfix) with SMTP id 648D9D1B4EB for ; Thu, 18 Sep 2003 20:22:04 -0300 (ADT) Received: (qmail 19434 invoked from network); 18 Sep 2003 23:22:06 -0000 Received: from jackfork.atoka.org (192.168.10.3) by mesozoic.atoka.org with SMTP; 18 Sep 2003 23:22:06 -0000 Content-Type: text/plain; charset="iso-8859-1" From: tom baker Reply-To: postgres@atoka-software.com Organization: Atoka Software To: Stephan Szabo Subject: Re: transaction locking Date: Thu, 18 Sep 2003 16:22:01 -0700 User-Agent: KMail/1.4.3 Cc: pgsql-sql@postgresql.org References: <200309172207.09134.postgres@atoka-software.com> <200309181111.42992.postgres@atoka-software.com> <20030918112013.O69397@megazone.bigpanda.com> In-Reply-To: <20030918112013.O69397@megazone.bigpanda.com> MIME-Version: 1.0 Content-Transfer-Encoding: quoted-printable Message-Id: <200309181622.03143.postgres@atoka-software.com> X-Virus-Scanned: by amavisd-new at postgresql.org X-Archive-Number: 200309/178 X-Sequence-Number: 15156 On Thursday 18 September 2003 11:24, Stephan Szabo pronounced: > 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=3Dpg_query( "BEGIN TRANSACTION" ) ; > > > > $sql =3D "LOCK TABLE parts IN SHARE ROW EXCLUSIVE MODE" ; > > $res =3D pg_query( $sql ) ; > > > > $sql =3D "SET CONSTRAINTS ALL DEFERRED" ; > > $res =3D pg_query( $sql ) ; > > > > if ( $amc_part_no =3D=3D "" ) > > { > > $sql =3D "SELECT max(amc_part_no) FROM parts WHERE amc_part_no like 'G= %'" > > ; $res =3D pg_query( $sql ) ; > > $amc_part_no =3D pg_fetch_result( $res , 0 , 0 ) ; > > # and generate the next part number... > > } > > > > $res =3D pg_query( $sql ) ; <<=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D > > > > $sql =3D "INSERT INTO parts VALUES ( '".$make."', '".$amc_part_no."', > > '".$group_no."', '".$subgroup_no."', '".$part_name."', > > '".$description."', '".$prim_grp."', '".$prim_sbg."', '".$no_req."', > > '".$weight."', > > '".$graphic."' )" ; > > $res =3D pg_query( $sql ) ; > > > > if ( ( $alt_group > "" ) ) > > { > > $sql =3D "INSERT INTO part_group ( make, amc_part_no, group_no ) VALUE= S ( > > '$make' , '$amc_part_no' , '$alt_group' ) " ; > > $res =3D pg_query( $sql ) ; > > } > > > > $sql =3D "INSERT INTO application VALUES ( > > '$make','$amc_part_no','$tyears', '$Amodel' )" ; > > $res =3D 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. stephan: i want to give you a great big thank you. THANK YOU!!!!! i was shooting myself in the foot vigorously. one sql statements were being= =20 executed twice, without the appropriate error checking (do i feel foolish o= r=20 what???? :(( ). see where i put "<<=3D=3D=3D=3D=3D" above! --=20 regards, tom baker former ingres programmer... Magary's Principle: When there is a public outcry to cut deadwood and fat from any government bureaucracy, it is the deadwood and the fat that do the cutting, and the public's services are cut.