Dump ALTER TABLE/SET STORAGE in pg_dump - Mailing list pgsql-patches

From Christopher Kings-Lynne
Subject Dump ALTER TABLE/SET STORAGE in pg_dump
Date
Msg-id 035601c2de1e$26ff5cd0$6500a8c0@fhp.internal
Whole thread Raw
Responses Re: Dump ALTER TABLE/SET STORAGE in pg_dump  (Bruce Momjian <pgman@candle.pha.pa.us>)
Re: Dump ALTER TABLE/SET STORAGE in pg_dump  (Bruce Momjian <pgman@candle.pha.pa.us>)
List pgsql-patches
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



pgsql-patches by date:

Previous
From: Hannu Krosing
Date:
Subject: Re: XML ouput for psql
Next
From: "Christopher Kings-Lynne"
Date:
Subject: Actual patch for last mail!