Re: Moving Specific Data Across Schemas Including FKs

From: Jim Nasby <Jim(dot)Nasby(at)BlueTreble(dot)com>
To: <rod(at)iol(dot)ie>, Cory Tucker <cory(dot)tucker(at)gmail(dot)com>, "pgsql-general(at)postgresql(dot)org" <pgsql-general(at)postgresql(dot)org>
Subject: Re: Moving Specific Data Across Schemas Including FKs
Date: 2015-04-23 20:27:38
Message-ID: 553955BA.8020600@BlueTreble.com
Views: Raw Message | Whole Thread | Download mbox | Resend email
Thread:
Lists: pgsql-general

On 4/23/15 1:08 PM, Raymond O'Donnell wrote:
>> What I am trying to figure out is that if I also have other relations
>> >that have foreign keys into the data I am moving, how would I also move
>> >the data from those relations and maintain the FK integrity?
> I'd create the tables in the new schema without the FK constraints, copy
> the data, then add the constraints afterwards.

You could also deffer the constraints, but that's probably going to be a
lot slower.
--
Jim Nasby, Data Architect, Blue Treble Consulting
Data in Trouble? Get it in Treble! http://BlueTreble.com

In response to

Browse pgsql-general by date

  From Date Subject
Next Message Jim Nasby 2015-04-23 20:34:28 Re: Invalid memory alloc
Previous Message Chris Mair 2015-04-23 20:17:51 Re: Invalid memory alloc