Re: libpq: usage of PQoidValue to obtain serial primary - Mailing list pgsql-interfaces

From Michal Dobaczewski
Subject Re: libpq: usage of PQoidValue to obtain serial primary
Date
Msg-id 40FFC654.9000903@cc.com.pl
Whole thread Raw
In response to Re: libpq: usage of PQoidValue to obtain serial primary key after insert  (Peter Eisentraut <peter_e@gmx.net>)
Responses Re: libpq: usage of PQoidValue to obtain serial primary key after insert
List 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.

Regards,

Michal Dobaczewski.




pgsql-interfaces by date:

Previous
From: Peter Eisentraut
Date:
Subject: Re: libpq: usage of PQoidValue to obtain serial primary key after insert
Next
From: "Motsoeneng Paseka * Spoornet (GP)"
Date:
Subject: Pgaccess questions