Re: portable DBAPI auto-increment

From: Karsten Hilbert <Karsten(dot)Hilbert(at)gmx(dot)net>
To: psycopg(at)postgresql(dot)org
Subject: Re: portable DBAPI auto-increment
Date: 2011-04-08 21:51:28
Message-ID: 20110408215128.GB2406@hermes.hilbert.loc
Views: Raw Message | Whole Thread | Download mbox | Resend email
Thread:
Lists: psycopg

On Fri, Apr 08, 2011 at 08:36:25PM +0300, Marko Kreen wrote:

> > On Thu, Apr 07, 2011 at 04:40:29PM -0400, Mark Sienkiewicz wrote:
> >> In psycopg2, I find that lastrowid is always 0, even though it is
> >> making rows in the table with k=1, k=2, etc.
> >>
> >> I did some searching and found that the value of lastrowid is not
> >> taken from the autoincrementing column, but is some non-unique entity
> >> called an OID.
> >
> > OIDs *are* unique per table.
>
> Actually they are not - you need unique index on oid column for that.
>
> That is also one of the reasons to avoid them...

Thanks for the correction.

Karsten
--
GPG key ID E4071346 @ gpg-keyserver.de
E167 67FD A291 2BEA 73BD 4537 78B9 A9F9 E407 1346

In response to

Browse psycopg by date

  From Date Subject
Next Message Mark Sienkiewicz 2011-04-11 18:29:35 Re: portable DBAPI auto-increment
Previous Message Adrian Klaver 2011-04-08 18:09:29 Re: portable DBAPI auto-increment