Re: Using ALTER TABLESPACE in pg_dump

From: Bruce Momjian <pgman(at)candle(dot)pha(dot)pa(dot)us>
To: Tom Lane <tgl(at)sss(dot)pgh(dot)pa(dot)us>
Cc: PostgreSQL-development <pgsql-hackers(at)postgresql(dot)org>
Subject: Re: Using ALTER TABLESPACE in pg_dump
Date: 2004-10-18 17:15:55
Message-ID: 200410181715.i9IHFtZ17253@candle.pha.pa.us
Views: Raw Message | Whole Thread | Download mbox | Resend email
Thread:
Lists: pgsql-hackers

Tom Lane wrote:
> Bruce Momjian <pgman(at)candle(dot)pha(dot)pa(dot)us> writes:
> > One additional idea for this item is to use CREATE to first create the
> > object, then move it using ALTER, and the ALTER might fail if the
> > tablespace doesn't exist.
>
> This seems fairly impractical, at least for indexes where there is no
> way to do the ALTER before the object is filled with data.
>
> > If we add a new SET variable and use it in pg_dump we will have to
> > support it forever even if there is no practical use for it.
>
> Yeah, that's one thing that bothers me.
>
> > One interesting side-affect of allowing tablespace specification to fail
> > is that it might give users enough control that we can mark this item as
> > done:
>
> Hmm, here's a variant idea: how about a GUC variable named something like
> "soft_tablespace_specs" which when TRUE would mean that a nonexistent
> tablespace name in a TABLESPACE clause is ignored (maybe with a WARNING)
> rather than being an error, and so the object is created in whatever the
> default tablespace for it would be. You wouldn't even necessarily want
> to have pg_dump set this true for itself, but people could turn it on
> when they needed to load a dump with wrong tablespace names in it.
> (If we didn't have pg_dump turn it on automatically, then we'd not be
> beholden to support it forever.)

That's a nice idea in that it doesn't require a SET for every object
that uses tablespace, and allows user control over tablespace failure.

The only downside is that it prevents SQL-compliant CREATE syntax in
dumps. I was thinking you could use ALTER just for tables but then the
tablespace failure rules would be different for tables and other
objects, which is unacceptable.

--
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

Responses

Browse pgsql-hackers by date

  From Date Subject
Next Message Tom Lane 2004-10-18 17:31:24 Re: tsearch2 windows make failure
Previous Message David Wheeler 2004-10-18 17:06:29 Re: libpq and prepared statements progress for 8.0