Skip site navigation (1) Skip section navigation (2)

Re: libpq: usage of PQoidValue to obtain serial primary

From: Michal Dobaczewski <mdobaczewski(at)cc(dot)com(dot)pl>
To: Peter Eisentraut <peter_e(at)gmx(dot)net>
Cc: pgsql-interfaces(at)postgresql(dot)org
Subject: Re: libpq: usage of PQoidValue to obtain serial primary
Date: 2004-07-22 13:51:16
Message-ID: (view raw, whole thread or download thread mbox)
Lists: pgsql-interfaces
Peter Eisentraut wrote:

> Am Donnerstag, 22. Juli 2004 13:14 schrieb Michal Dobaczewski:
>>Browsing the general list I've just read a post claiming that oid are
>>not guaranteed to be unique in the table. This is also stated in the
>>documentation - which seems to have escaped me this far. So I assume the
>>approach presented above is flawed.
>>I would like to ask what is a most elegant way to deal with such issues?
> Create a unique constraint on the oid column.

Thanks for the response.

I wonder: how will postgres behave if it happens to generate a 
repetitive oid for a table with such constraint? I understand it will 
work it out somehow internally and get a different oid, but I would like 
to be sure. It doesn't create a risk of inserts failing at random, does it?

I also understand this theoretically limits the number of rows in a 
table to 2^32 whereas without such constraint there is no set limit - is 
that true? It's not a problem, we don't have such big tables so far but 
it would be interesting to know.


Michal Dobaczewski.

In response to


pgsql-interfaces by date

Next:From: wespvpDate: 2004-07-22 17:29:03
Subject: Re: NULLs in ecpg
Previous:From: Peter EisentrautDate: 2004-07-22 12:44:56
Subject: Re: libpq: usage of PQoidValue to obtain serial primary key after insert

Privacy Policy | About PostgreSQL
Copyright © 1996-2017 The PostgreSQL Global Development Group