dbTalk Databases Forums  

Re: [NOVICE] How do I get an OID from a record in table?

mailing.database.pgsql-novice mailing.database.pgsql-novice


Discuss Re: [NOVICE] How do I get an OID from a record in table? in the mailing.database.pgsql-novice forum.



Reply
 
Thread Tools Display Modes
  #1  
Old   
Jaime Casanova
 
Posts: n/a

Default Re: [NOVICE] How do I get an OID from a record in table? - 11-26-2005 , 06:12 PM






On 11/26/05, Scott Simpson <Scott.Simpson (AT) computer (DOT) org> wrote:
Quote:
If I create a table with an OID field type, how do I set that field type?
That is, I have to look up the OID value in another table somewhere to set
my OID field and I don't know how to do that. (I'm trying to get one field
to point to another record). ADVthanksANCE.

SELECT oid FROM your_referenced_table;

oid is an especial field that is present in all row unless you had
specified WITHOUT OIDS...

i think in 8.1 WITHOUT OIDS is the DEFAULT...

it's not a good idea to do what you want to do... use a serial instead

--
regards,
Jaime Casanova
(DBA: DataBase Aniquilator

---------------------------(end of broadcast)---------------------------
TIP 1: if posting/reading through Usenet, please send an appropriate
subscribe-nomail command to majordomo (AT) postgresql (DOT) org so that your
message can get through to the mailing list cleanly


Reply With Quote
  #2  
Old   
Jaime Casanova
 
Posts: n/a

Default Re: [NOVICE] How do I get an OID from a record in table? - 11-29-2005 , 07:56 AM






On 11/29/05, Norberto Meijome <sys (AT) meijome (DOT) net> wrote:
Quote:
Jaime Casanova wrote:
On 11/26/05, Scott Simpson <Scott.Simpson (AT) computer (DOT) org> wrote:

If I create a table with an OID field type, how do I set that field
type?
That is, I have to look up the OID value in another table somewhere to
set
my OID field and I don't know how to do that. (I'm trying to get one
field
to point to another record). ADVthanksANCE.


Quote:
SELECT oid FROM your_referenced_table;
oid is an especial field that is
Quote:
present in all row unless you had
specified WITHOUT OIDS...

i think in 8.1
Quote:
WITHOUT OIDS is the DEFAULT...
it's not a good idea to do what you want to
Quote:
do... use a serial instead

Quote:
Jaime,
if one is not specifically using OIDs (as you described above), is there
any advantage to have tables defined WITH OIDs ? would it be better to al=
ter
the tables to WITHOUT OID (and then pg_dump and load again, i guess)

thanks!
Beto

The preferred way is to not use OID's in user tables... but AFAICS,
you will have no problem if you simply let them there (there is no
need for ALTERing and DUMPing)... i don't know if it will be a
reduction in the space if you don't have OIDs, will be?


--
regards,
Jaime Casanova
(DBA: DataBase Aniquilator

---------------------------(end of broadcast)---------------------------
TIP 3: Have you checked our extensive FAQ?

http://www.postgresql.org/docs/faq


Reply With Quote
Reply




Thread Tools
Display Modes

Posting Rules
You may not post new threads
You may not post replies
You may not post attachments
You may not edit your posts

vB code is On
Smilies are On
[IMG] code is On
HTML code is Off



Powered by vBulletin Version 3.5.3
Copyright ©2000 - 2013, Jelsoft Enterprises Ltd.