pg.ddx.io  pgsql-hackers@postgresql.org mailing list archive  
help / color / mirror / Atom feed
From: Laurenz Albe <laurenz.albe@cybertec.at>
To: Guillaume Lelarge <guillaume@lelarge.info>
To: PostgreSQL Hackers <pgsql-hackers@lists.postgresql.org>
Subject: Re: Extensions not dumped when --schema is used
Date: Wed, 20 May 2020 10:45:26 +0200
Message-ID: <fb577c38d175595672d00a3903229167516a5e7c.camel@cybertec.at> (raw)
In-Reply-To: <CAECtzeXOt4cnMU5+XMZzxBPJ_wu76pNy6HZKPRBL-j7yj1E4+g@mail.gmail.com>
References: <CAECtzeXOt4cnMU5+XMZzxBPJ_wu76pNy6HZKPRBL-j7yj1E4+g@mail.gmail.com>

On Wed, 2020-05-20 at 10:06 +0200, Guillaume Lelarge wrote:
> I've discovered something today that I didn't really expect.
> When a user dumps a database with the --schema flag of pg_dump,
> extensions in this schema aren't dumped. As far as I can tell,
> the documentation isn't clear about this ("Dump only schemas
> matching pattern; this selects both the schema itself, and all
> its contained objects."), though the source code definitely is
> ("We dump all user-added extensions by default, or none of them
> if include_everything is false (i.e., a --schema or --table
> switch was given).", in pg_dump.c).
> 
> I was wondering the reason behind this choice. If anyone knows,
> I'd be happy to hear about it.
> 
> I see two things:
> * it's been overlooked, and we should dump all the extensions
>   available in a schema if this schema has been selected through
>   the --schema flag.
> * it's kind of like the large objects handling, and I'd pretty
>   interested in adding a --extensions (as the same way there is a
>   --blobs flag).

I am not sure if there is a good reason for the current behavior,
but I'd favor the second solution.  I think as extensions as belonging
to the database rather than the schema; the schema is just where the
objects are housed.

Yours,
Laurenz Albe






view thread (38+ messages)  latest in thread

Message-ID: <fb577c38d175595672d00a3903229167516a5e7c.camel@cybertec.at>
Permalink:  ../fb577c38d175595672d00a3903229167516a5e7c.camel@cybertec.at/
Also on:    postgresql.org/message-id/fb577c38d175595672d00a3903229167516a5e7c.camel@cybertec.at

 · 

reply

Reply instructions:

You may reply publicly to this message via plain-text email
using any one of the following methods:

* Reply to all the recipients from your mail client; the link fills in
  the headers below: reply via email
  Some clients, webmail especially, drop In-Reply-To and References from
  a link, and the reply then starts a new thread: use the mbox below.

  To: pgsql-hackers@postgresql.org
  Cc: laurenz.albe@cybertec.at, guillaume@lelarge.info
  Subject: Re: Extensions not dumped when --schema is used
  In-Reply-To: <fb577c38d175595672d00a3903229167516a5e7c.camel@cybertec.at>
  References: <CAECtzeXOt4cnMU5+XMZzxBPJ_wu76pNy6HZKPRBL-j7yj1E4+g@mail.gmail.com> <fb577c38d175595672d00a3903229167516a5e7c.camel@cybertec.at>

* Save the following mbox file, import it into your mail client,
  and reply-to-all from there: mbox

This inbox is served by DDX for PostgreSQL; see mirroring instructions
for how to clone and mirror all data and code used for this inbox