pg.ddx.io pgsql-sql@postgresql.org mailing list archive
help / color / mirror / Atom feedoid and oidvector
5+ messages / 3 participants
[nested] [flat]
* oid and oidvector
@ 2002-04-10 11:19 Camila Rocha <camilarrocha@hotmail.com>
0 siblings, 1 reply; 5+ messages in thread
From: Camila Rocha @ 2002-04-10 11:19 UTC (permalink / raw)
To: pgsql-sql
Hi!
I'm from Brazil, and sorry about my english...
I'm having problems with the oid field, the field present in all tables. I
wanted to use it as a foreing key betwwen too tables, but i couldn't! is it
possible??
what about the data type oidvector?? i didn't find any documentation about
it, i wanted to use it to keep a lot of oids of other objects... like an
array of foreign keys, you know?
could you help me??
thanks!
_________________________________________________________________
MSN Photos is the easiest way to share and print your photos:
http://photos.msn.com/support/worldwide.aspx
^ permalink raw reply [nested|flat] 5+ messages in thread
* Re: oid and oidvector
@ 2002-04-15 19:13 Bruce Momjian <pgman@candle.pha.pa.us>
parent: Camila Rocha <camilarrocha@hotmail.com>
0 siblings, 1 reply; 5+ messages in thread
From: Bruce Momjian @ 2002-04-15 19:13 UTC (permalink / raw)
To: Camila Rocha <camilarrocha@hotmail.com>; +Cc: pgsql-sql
Camila Rocha wrote:
> Hi!
>
> I'm from Brazil, and sorry about my english...
> I'm having problems with the oid field, the field present in all tables. I
> wanted to use it as a foreing key betwwen too tables, but i couldn't! is it
> possible??
No, you can't use oid as a foreign key. You must use a PRIMARY column.
> what about the data type oidvector?? i didn't find any documentation about
> it, i wanted to use it to keep a lot of oids of other objects... like an
> array of foreign keys, you know?
oidvector is for internal db use. It is an array of 16 oid's.
--
Bruce Momjian | http://candle.pha.pa.us
pgman@candle.pha.pa.us | (610) 853-3000
+ If your life is a hard drive, | 830 Blythe Avenue
+ Christ can be your backup. | Drexel Hill, Pennsylvania 19026
^ permalink raw reply [nested|flat] 5+ messages in thread
* Re: oid and oidvector
@ 2002-04-15 20:36 Tom Lane <tgl@sss.pgh.pa.us>
parent: Bruce Momjian <pgman@candle.pha.pa.us>
0 siblings, 1 reply; 5+ messages in thread
From: Tom Lane @ 2002-04-15 20:36 UTC (permalink / raw)
To: Bruce Momjian <pgman@candle.pha.pa.us>; +Cc: Camila Rocha <camilarrocha@hotmail.com>; pgsql-sql
Bruce Momjian <pgman@candle.pha.pa.us> writes:
> No, you can't use oid as a foreign key. You must use a PRIMARY column.
Oh?
regression=# create table foo(f1 int);
CREATE
regression=# create unique index fooi on foo(oid);
CREATE
regression=# create table bar (ref oid references foo(oid));
NOTICE: CREATE TABLE will create implicit trigger(s) for FOREIGN KEY check(s)
CREATE
regression=#
I agree with the advice *not* to do this, but that doesn't mean it can't
be done.
regards, tom lane
^ permalink raw reply [nested|flat] 5+ messages in thread
* Re: oid and oidvector
@ 2002-04-15 20:39 Bruce Momjian <pgman@candle.pha.pa.us>
parent: Tom Lane <tgl@sss.pgh.pa.us>
0 siblings, 1 reply; 5+ messages in thread
From: Bruce Momjian @ 2002-04-15 20:39 UTC (permalink / raw)
To: Tom Lane <tgl@sss.pgh.pa.us>; +Cc: Camila Rocha <camilarrocha@hotmail.com>; pgsql-sql
Tom Lane wrote:
> Bruce Momjian <pgman@candle.pha.pa.us> writes:
> > No, you can't use oid as a foreign key. You must use a PRIMARY column.
>
> Oh?
>
> regression=# create table foo(f1 int);
> CREATE
> regression=# create unique index fooi on foo(oid);
> CREATE
> regression=# create table bar (ref oid references foo(oid));
> NOTICE: CREATE TABLE will create implicit trigger(s) for FOREIGN KEY check(s)
> CREATE
> regression=#
>
> I agree with the advice *not* to do this, but that doesn't mean it can't
> be done.
Oh, oh, TODO has:
* Allow oid to act as a foreign key
So I should mark the item as completed?
--
Bruce Momjian | http://candle.pha.pa.us
pgman@candle.pha.pa.us | (610) 853-3000
+ If your life is a hard drive, | 830 Blythe Avenue
+ Christ can be your backup. | Drexel Hill, Pennsylvania 19026
^ permalink raw reply [nested|flat] 5+ messages in thread
* Re: oid and oidvector
@ 2002-04-15 20:47 Tom Lane <tgl@sss.pgh.pa.us>
parent: Bruce Momjian <pgman@candle.pha.pa.us>
0 siblings, 0 replies; 5+ messages in thread
From: Tom Lane @ 2002-04-15 20:47 UTC (permalink / raw)
To: Bruce Momjian <pgman@candle.pha.pa.us>; +Cc: Camila Rocha <camilarrocha@hotmail.com>; pgsql-sql
Bruce Momjian <pgman@candle.pha.pa.us> writes:
> Oh, oh, TODO has:
> * Allow oid to act as a foreign key
> So I should mark the item as completed?
Guess so. This was fixed in 7.2 IIRC.
regards, tom lane
^ permalink raw reply [nested|flat] 5+ messages in thread
end of thread, other threads:[~2002-04-15 20:47 UTC | newest]
Thread overview: 5+ messages (download: mbox mbox.gz follow: Atom feed)
-- links below jump to the message on this page --
2002-04-10 11:19 oid and oidvector Camila Rocha <camilarrocha@hotmail.com>
2002-04-15 19:13 ` Bruce Momjian <pgman@candle.pha.pa.us>
2002-04-15 20:36 ` Tom Lane <tgl@sss.pgh.pa.us>
2002-04-15 20:39 ` Bruce Momjian <pgman@candle.pha.pa.us>
2002-04-15 20:47 ` Tom Lane <tgl@sss.pgh.pa.us>
This inbox is served by DDX for PostgreSQL; see mirroring instructions
for how to clone and mirror all data and code used for this inbox