pg.ddx.io  pgsql-odbc@postgresql.org mailing list archive  
help / color / mirror / Atom feed
From: Tom Lane <tgl@sss.pgh.pa.us>
To: scott.marlowe <scott.marlowe@ihs.com>
Cc: Ed Brown <ebrown@arcompanies.net>
Cc: Philippe Lang <philippe.lang@attiksystem.ch>
Cc: pgsql-odbc@postgresql.org
Subject: Re: @@IDENTITY (Was: Access - ODBC - serial problem)
Date: Mon, 12 Apr 2004 13:27:56 -0400
Message-ID: <11775.1081790876@sss.pgh.pa.us> (raw)
In-Reply-To: <Pine.LNX.4.33.0404121042530.14195-100000@css120.ihs.com>
References: <Pine.LNX.4.33.0404121042530.14195-100000@css120.ihs.com>

"scott.marlowe" <scott.marlowe@ihs.com> writes:
> [ use ORDER BY ... LIMIT instead of MAX ]

> However, I think you have to be in serializable transaction mode for that 
> code to be gauranteed not to get the wrong data.  But I'm not certain on 
> that one.

Yes, you need serializable mode with *either* method to ensure you see
your own row, and not one inserted later by another transaction that
managed to commit before you.  The ORDER BY trick is just to get around
Postgres' inability to connect MAX() to indexes; it doesn't affect the
transactional semantics at all.

			regards, tom lane



view thread (7+ messages)

Message-ID: <11775.1081790876@sss.pgh.pa.us>
Permalink:  ../11775.1081790876@sss.pgh.pa.us/
Also on:    postgresql.org/message-id/11775.1081790876@sss.pgh.pa.us

 · 

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: tgl@sss.pgh.pa.us, scott.marlowe@ihs.com, ebrown@arcompanies.net, philippe.lang@attiksystem.ch
  Subject: Re: @@IDENTITY (Was: Access - ODBC - serial problem)
  In-Reply-To: <11775.1081790876@sss.pgh.pa.us>
  References: <Pine.LNX.4.33.0404121042530.14195-100000@css120.ihs.com> <11775.1081790876@sss.pgh.pa.us>

* 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