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: 40FFC654.9000903@cc.com.pl
Views: Raw Message | Whole Thread | Download mbox | Resend email
Thread:
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.

Regards,

Michal Dobaczewski.

In response to

Responses

Browse pgsql-interfaces by date

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