RE: Re: OID as Primary Key

From: "Jonas Bengtsson" <jonas(dot)b(at)home(dot)se>
To: <pgsql-general(at)postgresql(dot)org>
Subject: RE: Re: OID as Primary Key
Date: 2001-03-22 16:54:15
Message-ID: NEBBLNLDOLDEJIKDPCBOKEDLCDAA.jonas.b@home.se
Views: Raw Message | Whole Thread | Download mbox | Resend email
Thread:
Lists: pgsql-general

Isn’t is better to use nextval(). If there are many simultaneous users
vurrval might give the value of another insert.

/Jonas B

-----Original Message-----
From: pgsql-general-owner(at)postgresql(dot)org
[mailto:pgsql-general-owner(at)postgresql(dot)org]On Behalf Of Michael Ansley
Sent: Thursday, March 22, 2001 5:50 PM
To: pgsql-general(at)postgresql(dot)org
Subject: RE: Re: [GENERAL] OID as Primary Key

And you can get the last SERIAL inserted using currval.
MikeA

>> -----Original Message-----
>> From: Brent R. Matzelle [ mailto:bmatzelle(at)yahoo(dot)com
<mailto:bmatzelle(at)yahoo(dot)com> ]
>> Sent: 22 March 2001 16:36
>> To: pgsql-general(at)postgresql(dot)org
>> Subject: Re: Re: [GENERAL] OID as Primary Key
>>
>>
>> --- Jonas Bengtsson <jonas(dot)b(at)home(dot)se> wrote:
>> > Can't you do a dump with the oid's?
>>
>> Yes, but I would never suggest it.
>>
>> > But when I want to know the primary key of the inserted row
>> > I have to do an extra select query. If I use oid I just use
>> > pg_getlastoid() in php.
>> > And it is redundant data to store another integer.
>>
>> You should not use oid's as primary keys just because you want
>> to save a little HD space.
>>
>> I contributed a some code on PHPBuilder for a function that
>> returns the insert id of a SERIAL primary key. You can view it
>> here:
>> http://www.phpbuilder.com/snippet/download.php?type=snippet&id=304
<http://www.phpbuilder.com/snippet/download.php?type=snippet&id=304>
>> . It works well for me and it does not kludge my code like
>> using the oid does.
>>
>> Brent
>>
>> __________________________________________________
>> Do You Yahoo!?
>> Get email at your own domain with Yahoo! Mail.
>> http://personal.mail.yahoo.com/ <http://personal.mail.yahoo.com/>
>>
>> ---------------------------(end of
>> broadcast)---------------------------
>> TIP 1: subscribe and unsubscribe commands go to
>> majordomo(at)postgresql(dot)org
>>

_________________________________________________________________________
This e-mail and any attachments are confidential and may also be privileged
and/or copyright
material of Intec Telecom Systems PLC (or its affiliated companies). If you
are not an
intended or authorised recipient of this e-mail or have received it in
error, please delete
it immediately and notify the sender by e-mail. In such a case, reading,
reproducing,
printing or further dissemination of this e-mail is strictly prohibited and
may be unlawful.
Intec Telecom Systems PLC. does not represent or warrant that an attachment
hereto is free
from computer viruses or other defects. The opinions expressed in this
e-mail and any
attachments may be those of the author and are not necessarily those of
Intec Telecom
Systems PLC.

This footnote also confirms that this email message has been swept by
MIMEsweeper for the presence of computer viruses.
__________________________________________________________________________

In response to

Browse pgsql-general by date

  From Date Subject
Next Message Stephan Szabo 2001-03-22 16:58:46 Re: OID as Primary Key
Previous Message Michael Ansley 2001-03-22 16:50:26 RE: Re: OID as Primary Key