From: | Ron Johnson <ron(dot)l(dot)johnson(at)cox(dot)net> |
---|---|
To: | PgSQL General ML <pgsql-general(at)postgresql(dot)org> |
Subject: | Re: Update of foreign key values |
Date: | 2003-08-11 22:38:17 |
Message-ID: | 1060641496.23344.58.camel@haggis |
Views: | Raw Message | Whole Thread | Download mbox | Resend email |
Thread: | |
Lists: | pgsql-general |
On Mon, 2003-08-11 at 14:04, Roderick A. Anderson wrote:
> I have two tables in two databases (Pg 7.2.1 - yes I need to upgrade but
> there are several other dependencies I have to resolve first) and I need
> to update one database's tables so they can be merged into the other
> database's table. I know I can drop the constraints and update the tables
> (primary key, and foreign key) but was hoping I'd not have to do that.
> An attempt at using the techniques in Joel Burton's "Referential
> Integrity Tutorial & Hacking the Referential Integrity tables" was
> unsuccessful.
>
> Is there a method I can use to add 1000 to all the primary and foreign
> keys in one pass? Searches using Google and the PostgreSQL docs turned up
> nothing useful to my situation. I see if the table/constraint would have
> been created differently the updates would have cascaded but that did
> not happen.
Maybe this will do it:
http://www.postgresql.org/docs/7.3/static/sql-set-constraints.html
begin;
set constraint foo DEFERRED;
update parent_table;
update child_table;
commit;
--
+---------------------------------------------------------------+
| Ron Johnson, Jr. Home: ron(dot)l(dot)johnson(at)cox(dot)net |
| Jefferson, LA USA |
| |
| "Man, I'm pretty. Hoo Hah!" |
| Johnny Bravo |
+---------------------------------------------------------------+
From | Date | Subject | |
---|---|---|---|
Next Message | Tom Lane | 2003-08-11 23:29:36 | Re: 7.4Beta1 "failed to create socket: Address family not |
Previous Message | Dennis Gearon | 2003-08-11 22:28:24 | Re: PostgreSQL |