Re: libpq doing strange things - Mailing list pgsql-interfaces

From Tom Lane
Subject Re: libpq doing strange things
Date
Msg-id 15369.1010449962@sss.pgh.pa.us
Whole thread Raw
In response to Re: libpq doing strange things  (Daniel Andersen <zedar@free2air.com.au>)
List pgsql-interfaces
Daniel Andersen <zedar@free2air.com.au> writes:
> Hrm i probably should have fixed up that earlier mistake in my code before 
> copying and pasting. The pgres_tuples_ok thing is irrelevant,the printed 
> results show pgres_command_ok is being returned, so as i said things should 
> theoretically be ok. But they aren't. The query is not being executed 
> correctly as the database is remaining unmodified, despite the query saying 
> it has updated one row (the expected result).

If the backend says it updated one row, then I'm reasonably confident
that it updated one row.  I'll bet your problem is that you're not
committing the transaction (eg, you issued BEGIN but no COMMIT).
In that case, the updated row never becomes visible outside your own
transaction.

> If i copy the query word for 
> word into the psql database interface, it is executed perfectly and update 
> the one record as it should.

This pretty much exonerates both the backend and libpq, seeing as how
psql is just an application built on top of libpq.  Time to start
looking at your own application logic.
        regards, tom lane


pgsql-interfaces by date:

Previous
From: Daniel Andersen
Date:
Subject: Re: libpq doing strange things
Next
From: Tim Nelson
Date:
Subject: [ECPG] generates bad code on declare/open