Re: error-free disabling of individual child partition

From: Andrew Dunstan <andrew(at)dunslane(dot)net>
To: "Jim C(dot) Nasby" <jnasby(at)pervasive(dot)com>
Cc: April Lorenzen <outboundindex(at)gmail(dot)com>, pgsql-hackers(at)postgresql(dot)org
Subject: Re: error-free disabling of individual child partition
Date: 2006-05-22 20:11:38
Message-ID: 44721AFA.4030405@dunslane.net
Views: Raw Message | Whole Thread | Download mbox | Resend email
Thread:
Lists: 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

In response to

Browse pgsql-hackers by date

  From Date Subject
Next Message Andrew Dunstan 2006-05-22 20:17:32 Re: Compiling PL/Perl and Pl/Python on x86_64
Previous Message Bruno Wolff III 2006-05-22 20:10:31 Re: group by points