Subject: Re: DBD::Pg - UPDATEs, INSERTs fail to work
To: Cillian Sharkey <cns@RedBrick.dcu.ie>
From: Jaromir Dolecek <jdolecek@netbsd.org>
List: tech-pkg
Date: 09/22/2002 19:53:02
You did COMMIT the update operation, didn't you? Note PostgreSQL is
transactional db, so you do need to commit every operation otherwise
it would be rolled back. psql might do implicit commit.

Jaromir

Cillian Sharkey wrote:
> Folks,
> 
> Perhaps this is a simple problem, but it's baffled me. My setup:
> 
> NetBSD 1.6
> Postgresql 7.2.1
> p5-DBI 1.21
> p5-DBD-postgresql 1.13nb1
> Perl 5.6.1nb7
> 
> As user "www" I can use psql to connect to my database and perform
> SELECTs, UPDATEs, INSERTs etc. with no problems.
> 
> I have a perl script using DBI which I also run as the www user (from
> the command line) and it can connect to the db and perform SELECTs with
> no problems. However INSERTs and UPDATEs do not work. The exact same
> query that works in psql fails to work in the script.
> 
> The bizarre part is that there are *no* error messages and the operation
> appears to be successful i.e. for an UPDATE it returns that 1 row was
> affected even though the operation never took effect!  (verifying with
> psql before and after). I have explicity set AutoCommit and PrintError
> to on even though they are the defaults. I enabled tracing but I can't
> see where it's going wrong. I have attached the output from trace(5) and
> my perl script.
> 
> Now if I try an UPDATE on a non-existant row it does return a value of
> zero as expected (i.e. no row was updated).
> 
> It's not a permissions problem; it works fine in psql as the same user
> and to verify this, I ran the script as a different user who only has
> SELECT access and it returned a permission denied error as expected. So
> it's definitely not an access or permission problem.
> 
> I have tried both prepare + execute() and do(). I have used the same
> code and setup before on a different machine (running Solaris) and it
> works perfectly.. 
> 
> I have already asked on the dbi mailing list.
> 
> Does anyone else have this setup working on 1.6?
> 
> -- 
> Cillian

[ Attachment, skipping... ]

[ Attachment, skipping... ]


-- 
Jaromir Dolecek <jdolecek@NetBSD.org>            http://www.NetBSD.org/
-=- We should be mindful of the potential goal, but as the tantric    -=-
-=- Buddhist masters say, ``You may notice during meditation that you -=-
-=- sometimes levitate or glow.   Do not let this distract you.''     -=-