INSERT & UPDATE - Mailing list pgsql-general

From Hillensbeck, Preston
Subject INSERT & UPDATE
Date
Msg-id 040AE3A029B3D51181D000508BC75D020138779D@MERCURY
Whole thread Raw
Responses Re: INSERT & UPDATE
List pgsql-general
I am trying to UPDATE a column after an INSERT, and getting a NULL result,
let me show you some code...  This is from a PHP page by the way

$sql="BEGIN WORK; INSERT INTO checking (check_date, check_amount,
check_number, check_payee, check_trans_type) VALUES ('$check_date',
'$check_amount', '$check_number', '$check_payee', '$check_trans_type');
UPDATE checking SET check_post_balance = (check_pre_balance -
$check_amount::money); COMMIT WORK;";

After the INSERT, I am trying to update the check_post_balance column to
check_pre_balance MINUS what the check_amount was.  I have tried many
variations on this and all I get are NULL results.  Can anyone see what in
the heck I am doing wrong?  :)   Thanks in advance!

Preston

pgsql-general by date:

Previous
From: Yury Don
Date:
Subject: Re: pltcl bug in 7.2?
Next
From: Alex Krohn
Date:
Subject: unable to repair table: missing chunk number