CREATE EXTENSION not adding extension on second SCHEMA

Started by PG Bug reporting formalmost 4 years ago5 messagesdocs
Jump to latest
#1PG Bug reporting form
noreply@postgresql.org

The following documentation comment has been logged on the website:

Page: https://www.postgresql.org/docs/14/sql-createextension.html
Description:

I'm trying to add an extension to two schemas that I have in my DB.

steps:

1)

CREATE EXTENSION unaccent with SCHEMA public;

response: OK.

2)

CREATE EXTENSION unaccent with SCHEMA public_test;

response: SQL Error [42710]: ERROR: extension "unaccent" already exists

I tryed:

SET search_path = public_test;
CREATE EXTENSION unaccent;

and the response is: response: SQL Error [42710]: ERROR: extension
"unaccent" already exists

#2jian he
jian.universality@gmail.com
In reply to: PG Bug reporting form (#1)
Re: CREATE EXTENSION not adding extension on second SCHEMA

quote from manual:

CREATE EXTENSION loads a new extension into the current database. There
must not be an extension of the same name already loaded.

You can try to alter[1]https://www.postgresql.org/docs/14/sql-alterextension.html the extension to make it located to another schema.

[1]: https://www.postgresql.org/docs/14/sql-alterextension.html

On Tue, May 31, 2022 at 8:39 PM PG Doc comments form <noreply@postgresql.org>
wrote:

The following documentation comment has been logged on the website:

Page: https://www.postgresql.org/docs/14/sql-createextension.html
Description:

I'm trying to add an extension to two schemas that I have in my DB.

steps:

1)

CREATE EXTENSION unaccent with SCHEMA public;

response: OK.

2)

CREATE EXTENSION unaccent with SCHEMA public_test;

response: SQL Error [42710]: ERROR: extension "unaccent" already exists

I tryed:

SET search_path = public_test;
CREATE EXTENSION unaccent;

and the response is: response: SQL Error [42710]: ERROR: extension
"unaccent" already exists

--
I recommend David Deutsch's <<The Beginning of Infinity>>

Jian

#3David G. Johnston
david.g.johnston@gmail.com
In reply to: PG Bug reporting form (#1)
Re: CREATE EXTENSION not adding extension on second SCHEMA

On Tuesday, May 31, 2022, PG Doc comments form <noreply@postgresql.org>
wrote:

The following documentation comment has been logged on the website:

Page: https://www.postgresql.org/docs/14/sql-createextension.html
Description:

I'm trying to add an extension to two schemas that I have in my DB.

steps:

1)

CREATE EXTENSION unaccent with SCHEMA public;

response: OK.

2)

CREATE EXTENSION unaccent with SCHEMA public_test;

response: SQL Error [42710]: ERROR: extension "unaccent" already exists

I tryed:

SET search_path = public_test;
CREATE EXTENSION unaccent;

and the response is: response: SQL Error [42710]: ERROR: extension
"unaccent" already exists

It doesn’t work and isn’t documented as something that does work. I really
don’t see a need to say you cannot install the same extension multiple
times explicitly - the self-describing error seems sufficient.

David J.

#4Tom Lane
tgl@sss.pgh.pa.us
In reply to: David G. Johnston (#3)
Re: CREATE EXTENSION not adding extension on second SCHEMA

"David G. Johnston" <david.g.johnston@gmail.com> writes:

On Tuesday, May 31, 2022, PG Doc comments form <noreply@postgresql.org>
wrote:

I'm trying to add an extension to two schemas that I have in my DB.

It doesn’t work and isn’t documented as something that does work. I really
don’t see a need to say you cannot install the same extension multiple
times explicitly - the self-describing error seems sufficient.

The CREATE EXTENSION reference page says

"There must not be an extension of the same name already loaded."

and later

"Remember that the extension itself is not considered to be within any
schema: extensions have unqualified names that must be unique
database-wide. But objects belonging to the extension can be within
schemas."

I hardly see how we could make this any plainer.

regards, tom lane

#5Gustavo
gustavomilc@gmail.com
In reply to: Tom Lane (#4)
Re: CREATE EXTENSION not adding extension on second SCHEMA

Thank you so much guys, my mistake I didn't pay attention. I'm new
to PostgreSQL and your help is much appreciated!

Em ter., 31 de mai. de 2022 às 12:32, Tom Lane <tgl@sss.pgh.pa.us> escreveu:

Show quoted text

"David G. Johnston" <david.g.johnston@gmail.com> writes:

On Tuesday, May 31, 2022, PG Doc comments form <noreply@postgresql.org>
wrote:

I'm trying to add an extension to two schemas that I have in my DB.

It doesn’t work and isn’t documented as something that does work. I

really

don’t see a need to say you cannot install the same extension multiple
times explicitly - the self-describing error seems sufficient.

The CREATE EXTENSION reference page says

"There must not be an extension of the same name already loaded."

and later

"Remember that the extension itself is not considered to be within any
schema: extensions have unqualified names that must be unique
database-wide. But objects belonging to the extension can be within
schemas."

I hardly see how we could make this any plainer.

regards, tom lane