Re: Dependency isn't created between extension and schema

From: James Coleman <jtc331(at)gmail(dot)com>
To: Michael Paquier <michael(at)paquier(dot)xyz>
Cc: Masahiko Sawada <sawada(dot)mshk(at)gmail(dot)com>, PostgreSQL Hackers <pgsql-hackers(at)lists(dot)postgresql(dot)org>
Subject: Re: Dependency isn't created between extension and schema
Date: 2020-12-21 13:29:42
Message-ID: CAAaqYe-HBPA=UpQJrXpdkG1Xqx2giL825VkAo2E9fYw9Gon0Pg@mail.gmail.com
Views: Raw Message | Whole Thread | Download mbox | Resend email
Thread:
Lists: pgsql-hackers

On Mon, Dec 21, 2020 at 2:59 AM Michael Paquier <michael(at)paquier(dot)xyz> wrote:
>
> On Mon, Dec 21, 2020 at 04:02:29PM +0900, Masahiko Sawada wrote:
> > Is it a bug? Since the created schema obviously depends on the
> > extension when we created the schema specified in the schema option, I
> > think we might want to create the dependency so that DROP EXTENSION
> > drops the schema as well. I’ve attached the draft patch so that CREATE
> > EXTENSION creates the dependency if it newly creates the schema.
>
> FWIW, I recall that the "soft" behavior that exists now is wanted, as
> it is more flexible for DROP EXTENSION: what you are suggesting here
> has the disadvantage to make DROP EXTENSION fail if any non-extension
> object has been created on this schema, so this could be disruptive
> when it comes to some upgrade scenarios.

That's potentially an issue even for a schema created explicitly by
the extension's install script, since anyone can create an object
within that schema at any time.

It seems that the only consistent behavior choice would be to mark the
dependency when Postgres is creating the extension automatically but
not when the schema already exists.

> <term><replaceable class="parameter">schema_name</replaceable></term>
> <listitem>
> <para>
> The name of the schema in which to install the extension's
> objects, given that the extension allows its contents to be
> relocated. The named schema must already exist.
> While on it.. The docs are incorrect here. As you say,
> CreateExtensionInternal() may internally create a schema.

Alternatively the behavior could be updated to match the docs, since
that seems like reasonable intent.

James

In response to

Responses

Browse pgsql-hackers by date

  From Date Subject
Next Message Laurenz Albe 2020-12-21 14:20:51 Re: allow to \dtS+ pg_toast.*
Previous Message Amit Kapila 2020-12-21 13:25:11 Re: [Patch] Optimize dropping of relation buffers using dlist