RE: Re: OID as Primary Key - Mailing list pgsql-general

From Jonas Bengtsson
Subject RE: Re: OID as Primary Key
Date
Msg-id NEBBLNLDOLDEJIKDPCBOKEDLCDAA.jonas.b@home.se
Whole thread Raw
In response to RE: Re: OID as Primary Key  (Michael Ansley <Michael.Ansley@intec-telecom-systems.com>)
List 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@postgresql.org [mailto:pgsql-general-owner@postgresql.org]On Behalf Of Michael Ansley
Sent: Thursday, March 22, 2001 5:50 PM
To: pgsql-general@postgresql.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@yahoo.com]
>> Sent: 22 March 2001 16:36
>> To: pgsql-general@postgresql.org
>> Subject: Re: Re: [GENERAL] OID as Primary Key
>>
>>
>> --- Jonas Bengtsson <jonas.b@home.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
>> .  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/
>>
>> ---------------------------(end of
>> broadcast)---------------------------
>> TIP 1: subscribe and unsubscribe commands go to
>> majordomo@postgresql.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.
__________________________________________________________________________

pgsql-general by date:

Previous
From: Michael Ansley
Date:
Subject: RE: Re: OID as Primary Key
Next
From: Stephan Szabo
Date:
Subject: Re: OID as Primary Key