pg.ddx.io  pgsql-odbc@postgresql.org mailing list archive  
help / color / mirror / Atom feed
From: mike.gagnon@bellnet.ca
To: pgsql-odbc@postgresql.org
Subject: wrong value returned?
Date: Wed, 11 Jun 2008 10:04:22 -0400
Message-ID: <6unltd$18tre9@toip37-bus.srvr.bell.ca> (raw)

Hi,

I've setup a query in my program to get the biggest value used in my "customers" table.  There is a serial column called customer_id.  I use the following query within my program and it returns, lets say, 3.  If I run the same query from the psql console window (over and over and at the same point where I've stepped to in my program), it will consistently return 2 whereas the program will consistently return 3 (always one more).

Here is the query to get the last ID used:
SELECT customer_id from customers order by customer_id DESC limit 1;

I do one fetch and have my result programmatically which is always 1 more than the value returned by the psql console window method.  What gives?

Many thanks,
Mike



view thread (2+ messages)  latest in thread

Message-ID: <6unltd$18tre9@toip37-bus.srvr.bell.ca>
Permalink:  ../6unltd$18tre9@toip37-bus.srvr.bell.ca/
Also on:    postgresql.org/message-id/6unltd$18tre9@toip37-bus.srvr.bell.ca

 · 

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 from your mail client; the link fills in
  the headers below: reply via email
  Some clients, webmail especially, drop In-Reply-To and References from
  a link, and the reply then starts a new thread: use the mbox below.

  To: pgsql-odbc@postgresql.org
  Cc: mike.gagnon@bellnet.ca
  Subject: Re: wrong value returned?
  In-Reply-To: <6unltd$18tre9@toip37-bus.srvr.bell.ca>
  References: <6unltd$18tre9@toip37-bus.srvr.bell.ca>

* 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