Lists: | pgsql-novice |
---|
From: | "Scott Simpson" <Scott(dot)Simpson(at)computer(dot)org> |
---|---|
To: | <pgsql-novice(at)postgresql(dot)org> |
Subject: | FW: How do I get an OID from a record in table? |
Date: | 2005-11-26 20:53:15 |
Message-ID: | 000701c5f2cb$6bf04b00$0401a8c0@scottsimpson.tv |
Views: | Raw Message | Whole Thread | Download mbox | Resend email |
Lists: | pgsql-novice |
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.
From: | Jaime Casanova <systemguards(at)gmail(dot)com> |
---|---|
To: | Scott Simpson <Scott(dot)Simpson(at)computer(dot)org> |
Cc: | pgsql-novice(at)postgresql(dot)org |
Subject: | Re: How do I get an OID from a record in table? |
Date: | 2005-11-27 00:12:24 |
Message-ID: | c2d9e70e0511261612j56bbf205o676cf97dfd1ab25@mail.gmail.com |
Views: | Raw Message | Whole Thread | Download mbox | Resend email |
Lists: | pgsql-novice |
On 11/26/05, Scott Simpson <Scott(dot)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.
>
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 ;)
From: | Norberto Meijome <sys(at)meijome(dot)net> |
---|---|
To: | Jaime Casanova <systemguards(at)gmail(dot)com> |
Cc: | pgsql-novice(at)postgresql(dot)org |
Subject: | Re: How do I get an OID from a record in table? |
Date: | 2005-11-29 12:22:36 |
Message-ID: | 438C480C.4080905@meijome.net |
Views: | Raw Message | Whole Thread | Download mbox | Resend email |
Lists: | pgsql-novice |
Jaime Casanova wrote:
>On 11/26/05, Scott Simpson <Scott(dot)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.
>>
>>
>>
>
>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
>
>
>
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 alter the tables to WITHOUT OID (and then pg_dump and load
again, i guess)
thanks!
Beto
From: | Jaime Casanova <systemguards(at)gmail(dot)com> |
---|---|
To: | Norberto Meijome <sys(at)meijome(dot)net> |
Cc: | pgsql-novice(at)postgresql(dot)org |
Subject: | Re: How do I get an OID from a record in table? |
Date: | 2005-11-29 13:55:32 |
Message-ID: | c2d9e70e0511290555n4a6ce880lf85171f13e5e74ab@mail.gmail.com |
Views: | Raw Message | Whole Thread | Download mbox | Resend email |
Lists: | pgsql-novice |
On 11/29/05, Norberto Meijome <sys(at)meijome(dot)net> wrote:
> Jaime Casanova wrote:
> On 11/26/05, Scott Simpson <Scott(dot)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.
> 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
> 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 alter
> 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 ;)