From: | Alex Rice <alex_rice(at)arc(dot)to> |
---|---|
To: | pgsql-general(at)postgresql(dot)org |
Subject: | oids vs. serial question |
Date: | 2002-03-02 00:10:47 |
Message-ID: | F2365117-2D71-11D6-9917-0030653DEAA0@arc.to |
Views: | Raw Message | Whole Thread | Download mbox | Resend email |
Thread: | |
Lists: | pgsql-general |
Hi, I'm new to PostreSQL, and I fear this might be a FAQ.
I am considering using OIDs for my application. I like the fact that
they are just automagic. However, the magic seems to disappear when it
comes to dumping and restoring data. Is there a way to get references to
oids across tables get restored correctly? I see that pg_dump has --oids
and pg_restore has --oid-order. But when I do a restore using
--oid-order, my oid references are all off by a constant number. For
example, if I have a oid column that is a references between these two
tables:
CREATE TABLE park (
region_oid oid references region,
primary key (oid),
...
);
CREATE TABLE region (
PRIMARY KEY (oid),
...
) ;
Then I do
pg_dump -Fc --oids > my.db
[drop tables]
pg_restore -Fc --oid-order my.db
Then the region_oid column values do not match the current oids in
region.oid. It can be fixed with a query, but someone (me) is sure to
forget to do this cleanup.
update park set region_oid = region_oid + DELTA
where DELTA is the difference of min(region.oid) and min(park.region_oid)
Am I missing something with the use of dump and restore, or should I
just forget it and use SERIAL columns?
Alex Rice, Software Developer
Architectural Research Consultants, Inc.
alex_rice(at)arc(dot)to
alrice(at)swcp(dot)com
From | Date | Subject | |
---|---|---|---|
Next Message | Neil Conway | 2002-03-02 00:13:41 | Re: Shared buffers vs large files |
Previous Message | Glen Parker | 2002-03-01 23:57:25 | Re: Shared buffers vs large files |