Thread: CREATE EXTENSION not adding extension on second SCHEMA

CREATE EXTENSION not adding extension on second SCHEMA

From
PG Doc comments form
Date:
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

Re: CREATE EXTENSION not adding extension on second SCHEMA

From
jian he
Date:
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] the extension to make it located to another schema.



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


Re: CREATE EXTENSION not adding extension on second SCHEMA

From
"David G. Johnston"
Date:
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.

Re: CREATE EXTENSION not adding extension on second SCHEMA

From
Tom Lane
Date:
"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



Re: CREATE EXTENSION not adding extension on second SCHEMA

From
Gustavo
Date:
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:
"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