Re: @@IDENTITY (Was: Access - ODBC - serial problem)

From: Tom Lane <tgl(at)sss(dot)pgh(dot)pa(dot)us>
To: "scott(dot)marlowe" <scott(dot)marlowe(at)ihs(dot)com>
Cc: Ed Brown <ebrown(at)arcompanies(dot)net>, Philippe Lang <philippe(dot)lang(at)attiksystem(dot)ch>, pgsql-odbc(at)postgresql(dot)org
Subject: Re: @@IDENTITY (Was: Access - ODBC - serial problem)
Date: 2004-04-12 17:27:56
Message-ID: 11775.1081790876@sss.pgh.pa.us
Views: Raw Message | Whole Thread | Download mbox | Resend email
Thread:
Lists: pgsql-odbc

"scott.marlowe" <scott(dot)marlowe(at)ihs(dot)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

In response to

Responses

Browse pgsql-odbc by date

  From Date Subject
Next Message Chris Gamache 2004-04-12 20:33:24 LOG: unexpected EOF on client connection
Previous Message scott.marlowe 2004-04-12 16:44:37 Re: @@IDENTITY (Was: Access - ODBC - serial problem)