pg.ddx.io  pgsql-sql@postgresql.org mailing list archive  
help / color / mirror / Atom feed
From: Stephan Szabo <sszabo@megazone.bigpanda.com>
To: tom baker <postgres@atoka-software.com>
Cc: pgsql-sql@postgresql.org
Subject: Re: transaction locking
Date: Thu, 18 Sep 2003 11:24:26 -0700 (PDT)
Message-ID: <20030918112013.O69397@megazone.bigpanda.com> (raw)
In-Reply-To: <200309181111.42992.postgres@atoka-software.com>
References: <200309172207.09134.postgres@atoka-software.com>
	<20030917223104.D58881@megazone.bigpanda.com>
	<200309181111.42992.postgres@atoka-software.com>

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.



view thread (5+ messages)  latest in thread

Message-ID: <20030918112013.O69397@megazone.bigpanda.com>
Permalink:  ../20030918112013.O69397@megazone.bigpanda.com/
Also on:    postgresql.org/message-id/20030918112013.O69397@megazone.bigpanda.com

 · 

reply

Reply instructions:

You may reply publicly to this message via plain-text email
using any one of the following methods:

* Reply to all the recipients using the --to and --cc options:
  reply via email

  To: pgsql-sql@postgresql.org
  Cc: sszabo@megazone.bigpanda.com, postgres@atoka-software.com
  Subject: Re: transaction locking
  In-Reply-To: <20030918112013.O69397@megazone.bigpanda.com>

* Save the following mbox file, import it into your mail client,
  and reply-to-all from there: mbox

This inbox is served by DDX for PostgreSQL; see mirroring instructions
for how to clone and mirror all data and code used for this inbox