Re: portable DBAPI auto-increment

From: Marko Kreen <markokr(at)gmail(dot)com>
To: Karsten Hilbert <Karsten(dot)Hilbert(at)gmx(dot)net>
Cc: psycopg(at)postgresql(dot)org
Subject: Re: portable DBAPI auto-increment
Date: 2011-04-08 17:36:25
Message-ID: BANLkTikpxcur-5dCAZ7dMNwNWAD3KffNGA@mail.gmail.com
Views: Raw Message | Whole Thread | Download mbox | Resend email
Thread:
Lists: psycopg

On Fri, Apr 8, 2011 at 12:52 PM, Karsten Hilbert
<Karsten(dot)Hilbert(at)gmx(dot)net> 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...

--
marko

In response to

Responses

Browse psycopg by date

  From Date Subject
Next Message Daniele Varrazzo 2011-04-08 17:40:42 Re: portable DBAPI auto-increment
Previous Message David Blewett 2011-04-08 17:04:46 Re: portable DBAPI auto-increment