Re: Using ALTER TABLESPACE in pg_dump - Mailing list pgsql-hackers

From Tom Lane
Subject Re: Using ALTER TABLESPACE in pg_dump
Date
Msg-id 17650.1098210042@sss.pgh.pa.us
Whole thread Raw
In response to Re: Using ALTER TABLESPACE in pg_dump  (Philip Warner <pjw@rhyme.com.au>)
Responses Re: Using ALTER TABLESPACE in pg_dump
List pgsql-hackers
Philip Warner <pjw@rhyme.com.au> writes:
> DEFINITION: CREATE TABLE fred ... %%tablespace%% ...
> TABLESPACE: ' TABLESPACE t'

> pg_restore would read these, and use the settings from the command line to 
> either substitute an empty string or the TABLESPACE text for %%tablespace%% 
> in the DEFINTION.

Nope.  I can break that trivially, eg:

CREATE INDEX fooi ON foo (f1) WHERE upper(f1) < ' %%tablespace%%';

Not very probable, maybe, but you can't just do a blind sed-style
substitution.

There's also the nontrivial matter of how pg_dump would decide where to
insert the %%tablespace%% string into the CREATE INDEX command in the
first place.  If we're going to add code to parse CREATE INDEX and
insert the tablespace in the correct place, meseems it'd be better to
insert it on the pg_restore side.
        regards, tom lane


pgsql-hackers by date:

Previous
From: Philip Warner
Date:
Subject: Re: Using ALTER TABLESPACE in pg_dump
Next
From: "Marc G. Fournier"
Date:
Subject: Re: Time off