[PATCH] Relocation of tablespaces in pg_basebackup

From: Steeve Lennmark <steevel(at)handeldsbanken(dot)se>
To: pgsql-hackers(at)postgresql(dot)org
Subject: [PATCH] Relocation of tablespaces in pg_basebackup
Date: 2014-01-09 17:58:22
Message-ID: CADAK8w6ph7kNDUr9Unqyh0w7q=C=fJzAnb2K88eyFsiPuNOzpQ@mail.gmail.com
Views: Raw Message | Whole Thread | Download mbox | Resend email
Thread:
Lists: pgsql-hackers

Currently pg_basebackup is pretty invasive when using tablespaces, at
least using the plain format. This since it requires the tablespace to
be written to the same location as on the server beeing backed up. This
both breaks backing up locally using -Fp (since the tablespace would
be written to the same location) and requires the backup user to have
write permissions in locations it shouldn't need to have access to.

This patch adds the ability to relocate tablespaces by adding the
command line argument --tablespace (-T) which takes a required argument
in the format "oid:tablespacedir". After all tablespaces are fetched
this code updates the symlink to point to the new tablespace location.

I would have loved to be able to pass tablespacename:tablespacedir
though, but sadly I wasn't able to figure out how to retrieve that
information without creating another connection to the database.

This feature might be missing because of some other limitation I fail
to see, if so let me know. Please be gentle, this is my first patch ;-)

Attachment Content-Type Size
0001-SQL-assertions-prototype.patch application/octet-stream 69.4 KB

Responses

Browse pgsql-hackers by date

  From Date Subject
Next Message Alvaro Herrera 2014-01-09 17:58:41 Re: Add CREATE support to event triggers
Previous Message Robert Haas 2014-01-09 17:53:36 Re: integrate pg_upgrade analyze_new_cluster.sh into vacuumdb