Re: error-free disabling of individual child partition - Mailing list pgsql-hackers

From Andrew Dunstan
Subject Re: error-free disabling of individual child partition
Date
Msg-id 44721AFA.4030405@dunslane.net
Whole thread Raw
In response to Re: error-free disabling of individual child partition  ("Jim C. Nasby" <jnasby@pervasive.com>)
List pgsql-hackers
Jim C. Nasby wrote:
> On Mon, May 22, 2006 at 03:28:39PM -0400, Andrew Dunstan wrote:
>   
>> Jim C. Nasby wrote:
>>     
>>> BEGIN;
>>> -- Don't do the drop right now, because it might take awhile
>>> ALTER TABLE tablename RENAME TO delete_tablename;
>>> ALTER TABLE temporary_tablename RENAME TO tablename;
>>> COMMIT;
>>> DROP delete_tablename;
>>>
>>>  
>>>       
>> What if there are dependencies? Might be better to have a view, which 
>> everything depends on, and change the view definition from one table to 
>> another back and forth.
>>     
>
> What dependencies would there be that a view would solve? You can't
> define RI on a view AFAIK...
>   

functions, rules, other views ... RI is not the only source of dependencies.

you would do this:

< load table_a >
create or replace view v as select * from table_a;
drop if exists table table_b;

next time around swap table_a and table_b, or you could write some 
plpgsql or plperl to do it nicely for you.

cheers

andrew


pgsql-hackers by date:

Previous
From: Bruno Wolff III
Date:
Subject: Re: group by points
Next
From: Andrew Dunstan
Date:
Subject: Re: Compiling PL/Perl and Pl/Python on x86_64