Skip site navigation (1) Skip section navigation (2)

Re: Dump ALTER TABLE/SET STORAGE in pg_dump

From: Bruce Momjian <pgman(at)candle(dot)pha(dot)pa(dot)us>
To: Christopher Kings-Lynne <chriskl(at)familyhealth(dot)com(dot)au>
Cc: Patches <pgsql-patches(at)postgresql(dot)org>
Subject: Re: Dump ALTER TABLE/SET STORAGE in pg_dump
Date: 2003-03-20 06:26:29
Message-ID: 200303200626.h2K6QTL18684@candle.pha.pa.us (view raw or flat)
Thread:
Lists: pgsql-patches
Patch applied.  Thanks.

Backpatching seems too risky.  Other comments?

---------------------------------------------------------------------------


Christopher Kings-Lynne wrote:
> This patch make pg_dump properly dump ALTER TABLE/SET STORAGE statements.
> It has been tested only against CVS backend, however.  Some checking of the
> changes to the SQL to retrieve attributes for older versions of Postgres is
> probably wise.  Also, please make sure that I have mapped the storage types
> to the correct storage names, as this is relatively poorly documented.
> 
> I think that this patch might need to be considered for back-porting to
> 7.3.3 since at the moment, people will be losing valuable information after
> upgrades.
> 
> Example output:
> 
> test=# create table test (a text, b text, c text, d text);
> CREATE TABLE
> test=# alter table test alter a set storage plain;
> ALTER TABLE
> test=# alter table test alter a set storage external;
> ALTER TABLE
> test=# alter table test alter a set storage plain;
> ALTER TABLE
> test=# alter table test alter b set storage extended;
> ALTER TABLE
> test=# alter table test alter c set storage external;
> ALTER TABLE
> test=# alter table test alter d set storage main;
> ALTER TABLE
> test=# alter table test alter b set statistics 1000;
> ALTER TABLE
> test=# alter table test alter a set statistics 55;
> ALTER TABLE
> test=# \q
> 
> Will dump:
> 
> CREATE TABLE test (
>     a text,
>     b text,
>     c text,
>     d text
> );
> ALTER TABLE ONLY test ALTER COLUMN a SET STATISTICS 55;
> ALTER TABLE ONLY test ALTER COLUMN a SET STORAGE PLAIN;
> ALTER TABLE ONLY test ALTER COLUMN b SET STATISTICS 1000;
> ALTER TABLE ONLY test ALTER COLUMN c SET STORAGE EXTERNAL;
> ALTER TABLE ONLY test ALTER COLUMN d SET STORAGE MAIN;
> 
> Chris
> 
> 
> 
> ---------------------------(end of broadcast)---------------------------
> TIP 4: Don't 'kill -9' the postmaster
> 

-- 
  Bruce Momjian                        |  http://candle.pha.pa.us
  pgman(at)candle(dot)pha(dot)pa(dot)us               |  (610) 359-1001
  +  If your life is a hard drive,     |  13 Roberts Road
  +  Christ can be your backup.        |  Newtown Square, Pennsylvania 19073

In response to

pgsql-patches by date

Next:From: Bruce MomjianDate: 2003-03-20 06:45:31
Subject: Re: psql patch (2)
Previous:From: Bruce MomjianDate: 2003-03-20 06:23:36
Subject: Re: PGRES_POLLING_ACTIVE is unused...

Privacy Policy | About PostgreSQL
Copyright © 1996-2014 The PostgreSQL Global Development Group