Re: pg_dumpall and tablespaces

From: Adrian Klaver <adrian(dot)klaver(at)aklaver(dot)com>
To: Joao Miguel Ferreira <joao(dot)miguel(dot)c(dot)ferreira(at)gmail(dot)com>, pgsql-general <pgsql-general(at)lists(dot)postgresql(dot)org>
Subject: Re: pg_dumpall and tablespaces
Date: 2021-02-02 16:52:43
Message-ID: aefc0690-e394-4ea3-7006-9ea79204e497@aklaver.com
Views: Raw Message | Whole Thread | Download mbox | Resend email
Thread:
Lists: pgsql-general

On 2/2/21 8:43 AM, Joao Miguel Ferreira wrote:
> Hello all,
>
> I have a dump file obtained from pg_dumpall on a MAC computer. I need to
> load in onto my Linux laptop running postgres.
>
> My scenario is software development. I'm trying to load the dump onto my
> Pg installation running on Linux (and later possibly on Linux over
> Docker) in order to perform my sw development against a fresh copy of
> the data.
>
> I got 2 problems concerning tablespaces:
> a) during the restore step I get lots of errors about the necessity to
> have root permissions to re-create the tablespaces and
> b) the tablespaces paths on the dump file are bound to the MAC
> filesystem (/Users/..../pg/....). I would need to re-write that path to
> my home folder or '/var/lib/....'
>
> Obviously I'm a bit confused on how to do this.
>
> pg_dumpall is very powerfull and simple, specially when using the
> "--create" option that does all the work for me.
>
> I would appreciate any directions on how to restore that dump

Do you want to maintain tablespaces on the dev machine?

If not from here:

https://www.postgresql.org/docs/12/app-pg-dumpall.html

--no-tablespaces

Do not output commands to create tablespaces nor select tablespaces
for objects. With this option, all objects will be created in whichever
tablespace is the default during restore.

This would have to be done when the pg_dumpall is run.

>
> thank you
> Joao
>

--
Adrian Klaver
adrian(dot)klaver(at)aklaver(dot)com

In response to

Responses

Browse pgsql-general by date

  From Date Subject
Next Message Andrus 2021-02-02 17:05:54 Re: permission denied for large object 200936761
Previous Message Joao Miguel Ferreira 2021-02-02 16:43:47 pg_dumpall and tablespaces