Prevent extension creation in temporary schemas

From: Michael Paquier <michael(at)paquier(dot)xyz>
To: Postgres hackers <pgsql-hackers(at)lists(dot)postgresql(dot)org>
Subject: Prevent extension creation in temporary schemas
Date: 2019-01-07 03:26:12
Views: Raw Message | Whole Thread | Download mbox | Resend email
Lists: pgsql-hackers

Hi all,

While looking at another bug I have noticed that it is possible to
create an extension directly using a temporary schema, which is
crazy. A simple example:
=# create extension pg_prewarm with schema pg_temp_3;
=# \dx pg_prewarm
List of installed extensions
Name | Version | Schema | Description
pg_prewarm | 1.2 | pg_temp_3 | prewarm relation data
(1 row)

When also creating some extensions, like pageinspect, then the error
message gets a bit crazier, complaining about things not existing.
This combination makes no actual sense, so wouldn't it be better to
restrict the case? When trying to use ALTER EXTENSION SET SCHEMA we
already have a similar error:
=# alter extension pageinspect set schema pg_temp_3;
ERROR: 0A000: cannot move objects into or out of temporary schemas
LOCATION: CheckSetNamespace, namespace.c:2954

Attached is an idea of patch, the test case is a bit bulky to remain
portable though.


Attachment Content-Type Size
extension-temp-schema.patch text/x-diff 3.5 KB


Browse pgsql-hackers by date

  From Date Subject
Next Message Amit Langote 2019-01-07 04:49:49 Re: [Sender Address Forgery]Re: error message when subscription target is a partitioned table
Previous Message Karl O. Pinc 2019-01-07 03:17:03 Doc client_min_messages patch vis. INFO message severity