oh dear - have i messed up my OIDs?

From: brian ally <brian(at)zijn-digital(dot)com>
To: pgsql-general(at)postgresql(dot)org
Subject: oh dear - have i messed up my OIDs?
Date: 2006-06-25 19:14:41
Message-ID: 449EE0A1.4070105@zijn-digital.com
Views: Raw Message | Whole Thread | Download mbox | Resend email
Thread:
Lists: pgsql-general

I have a table which required some modifications, but making these
changes meant that i had to adjust some functions and types, as well. As
the DB is not "live" yet, i simply dumped everything, and copied the
bits that needed changes to a new file, made the changes, and ran that.
Unfortunately, when it came it the inital data i had (only ~50 rows), i
used the part of the script i had created to INSERT them, instead of
using the COPY that pg_dump had provided. So, no OIDs. The reason i did
this was because i was adding another couple of rows at the same time.

This seems to have been a big mistake. Now, any new rows i insert have
their primary key beginning back from the beginning. So, i have double
primary keys as "1", "2", etc. I realise that i should have left the
COPY run in place, after some editing, but at the time it seemed easy to
edit the old INSERT statements with a search & replace.

My question is, can i safely run my modifications again, but swap out
the INSERTs for the COPY WITH OIDs bit from the dump (adding my new
INSERTs after)? Would those OIDs still be "good", so to speak?

The script i had created for the mods is way too long to add here, but
here are some of the statements that i had copied from the dump:

-- snip --
SET client_encoding = 'SQL_ASCII';
SET check_function_bodies = false;
SET client_min_messages = warning;

SET search_path = public, pg_catalog;

ALTER TABLE ONLY public.event_discipline DROP CONSTRAINT
fk_event_discipline_did;

DROP INDEX public.event_discipline_e_id_idx;
DROP INDEX public.event_discipline_d_id_idx;

ALTER TABLE ONLY public.event_discipline DROP CONSTRAINT
event_discipline_e_id_key;

DROP TABLE public.event_discipline;
DROP TABLE public.event;

DROP FUNCTION public.getmonthevents(this_month date, discipline_id
integer, region_id integer);
DROP FUNCTION public.getmonthevents(this_month date, region_id integer);
DROP FUNCTION public.getdateevents(this_date date, discipline_id
integer, region_id integer);

DROP TYPE public.month_event;
DROP TYPE public.date_event;
-- snip --

After that, i defined my types, tables, and functions, and added the
ALTER statements to grant me permissions.

ANY advice appreciated.

brian

Responses

Browse pgsql-general by date

  From Date Subject
Next Message Mark Gibson 2006-06-25 22:21:10 Re: casting... adding integer to timestamp
Previous Message chrisek 2006-06-25 19:05:04 "Ghost" colmumn with primary key