Re: Extensions not dumped when --schema is used

From: Guillaume Lelarge <guillaume(at)lelarge(dot)info>
To: Michael Paquier <michael(at)paquier(dot)xyz>
Cc: Julien Rouhaud <rjuju123(at)gmail(dot)com>, Tom Lane <tgl(at)sss(dot)pgh(dot)pa(dot)us>, Daniel Gustafsson <daniel(at)yesql(dot)se>, PostgreSQL Hackers <pgsql-hackers(at)lists(dot)postgresql(dot)org>
Subject: Re: Extensions not dumped when --schema is used
Date: 2021-02-20 21:38:36
Message-ID: CAECtzeUFHFrEaEG7QDvd7DwVCiapqLks5rOFa9OX+1N5zn84Zw@mail.gmail.com
Views: Raw Message | Whole Thread | Download mbox | Resend email
Thread:
Lists: pgsql-hackers

Le sam. 20 févr. 2021 à 13:25, Michael Paquier <michael(at)paquier(dot)xyz> a
écrit :

> On Thu, Feb 18, 2021 at 11:13:06AM +0100, Guillaume Lelarge wrote:
> > I finally managed to get a working TAP test for my patch. I have no idea
> if
> > it's good, and if it's enough. Anyway, new version of the patch attached.
>
> As presented in this patch, specifying both --extension and
> --table/--schema means that pg_dump will dump both tables and
> extensions matching the pattern passed down. But shouldn't extensions
> not be dumped if --table or --schema is used? Combining --schema with
> --table implies that the schema part is ignored, for instance.
>
>
Actually, that's the whole point of the patch. Imagine someone who wants to
backup a table with a citext column. With the --table option, this user
will only have the table, without the extension that would allow to restore
the dump. He will have to remember to create the extension before. The new
option allows him to add the CREATE EXTENSION he needs into his dump.

The comment at the top of selectDumpableExtension() is incorrect,
> missing the new case added by --extension.
>
> The use of strict_names looks right to me, but you have missed a
> refresh of the documentation of --strict-names that applies to
> --extension with this patch.
>
> + dump_cmd => [
> + 'pg_dump', "--file=$tempdir/test_schema_plus_extensions.sql",
> + '--schema=dump_test', '--extension=plpgsql', '--no-sync',
> What's the goal of this test. plpgsql is a system extension so it
> will never be dumped. It seems to me that any tests related to this
> patch should be added to src/test/modules/test_pg_dump/, which
> includes a custom extension in the test, that could be dumped.
>
> + dumped. Multiple schemas can be selected by writing multiple
> + <option>-e</option> switches. The <replaceable
> s/schemas/extensions/.
>

You're right on all these points. I'm on vacation this week, but I'll build
a v3 with these issues fixed when I'll get back from vacation.

Thanks.

--
Guillaume.

In response to

Browse pgsql-hackers by date

  From Date Subject
Next Message Guillaume Lelarge 2021-02-20 21:39:24 Re: Extensions not dumped when --schema is used
Previous Message John Naylor 2021-02-20 21:10:58 Re: [POC] verifying UTF-8 using SIMD instructions