Обсуждение: BUG #13583: Documentation "5.8.2. The Public Schema" misleading

Поиск
Список
Период
Сортировка

BUG #13583: Documentation "5.8.2. The Public Schema" misleading

От
mina@naguib.ca
Дата:
The following bug has been logged on the website:

Bug reference:      13583
Logged by:          Mina Naguib
Email address:      mina@naguib.ca
PostgreSQL version: 9.5alpha2
Operating system:   N/A
Description:

This section of the documentation states:

"...  we created tables without specifying any schema ... are automatically
put into a schema named "public" ..."

This is not true.  At least from my tests, the search_path is taken into
account.

My search_path is set to "$user",public, and therefore a barebones "create
table foo();" creates the table foo in the "mina" schema, not the "public"
schema.

Re: BUG #13583: Documentation "5.8.2. The Public Schema" misleading

От
Jeff Janes
Дата:
On Thu, Aug 20, 2015 at 10:51 AM, <mina@naguib.ca> wrote:

> The following bug has been logged on the website:
>
> Bug reference:      13583
> Logged by:          Mina Naguib
> Email address:      mina@naguib.ca
> PostgreSQL version: 9.5alpha2
> Operating system:   N/A
> Description:
>
> This section of the documentation states:
>
> "...  we created tables without specifying any schema ... are automatically
> put into a schema named "public" ..."
>
> This is not true.  At least from my tests, the search_path is taken into
> account.
>
> My search_path is set to "$user",public, and therefore a barebones "create
> table foo();" creates the table foo in the "mina" schema, not the "public"
> schema.
>

By default, there is no schema named "mina".  That part of the
documentation is describing the behavior under this default condition.  The
next section goes on to explain what happens when you have created a schema
that matches your user name.

Cheers,

Jeff

Re: BUG #13583: Documentation "5.8.2. The Public Schema" misleading

От
John McKown
Дата:
On Thu, Aug 20, 2015 at 12:51 PM, <mina@naguib.ca> wrote:

> The following bug has been logged on the website:
>
> Bug reference:      13583
> Logged by:          Mina Naguib
> Email address:      mina@naguib.ca
> PostgreSQL version: 9.5alpha2
> Operating system:   N/A
> Description:
>
> This section of the documentation states:
>
> "...  we created tables without specifying any schema ... are automatical=
ly
> put into a schema named "public" ..."
>
> This is not true.  At least from my tests, the search_path is taken into
> account.
>
> My search_path is set to "$user",public, and therefore a barebones "creat=
e
> table foo();" creates the table foo in the "mina" schema, not the "public=
"
> schema.
>
>
>
=E2=80=8BI think this depends on you, the user, creating the proper schema.=
 I don't
think that an "initdb" creates any schemas other than "public". At least,
that has been my experience so far.=E2=80=8B

--=20

Schrodinger's backup: The condition of any backup is unknown until a
restore is attempted.

Yoda of Borg, we are. Futile, resistance is, yes. Assimilated, you will be.

He's about as useful as a wax frying pan.

10 to the 12th power microphones =3D 1 Megaphone

Maranatha! <><
John McKown

Re: BUG #13583: Documentation "5.8.2. The Public Schema" misleading

От
"David G. Johnston"
Дата:
On Thu, Aug 20, 2015 at 2:14 PM, John McKown <john.archie.mckown@gmail.com>
wrote:

> On Thu, Aug 20, 2015 at 12:51 PM, <mina@naguib.ca> wrote:
>
>> The following bug has been logged on the website:
>>
>> Bug reference:      13583
>> Logged by:          Mina Naguib
>> Email address:      mina@naguib.ca
>> PostgreSQL version: 9.5alpha2
>> Operating system:   N/A
>> Description:
>>
>> This section of the documentation states:
>>
>> "...  we created tables without specifying any schema ... are
>> automatically
>> put into a schema named "public" ..."
>>
>> This is not true.  At least from my tests, the search_path is taken into
>> account.
>>
>> My search_path is set to "$user",public, and therefore a barebones "crea=
te
>> table foo();" creates the table foo in the "mina" schema, not the "publi=
c"
>> schema.
>>
>>
>>
> =E2=80=8BI think this depends on you, the user, creating the proper schem=
a. I
> don't think that an "initdb" creates any schemas other than "public". At
> least, that has been my experience so far.=E2=80=8B
>

So basically the key phrase in that paragraph is "by default".  The reader
is intended to take that to mean "with only the schemas created by initdb".

Now, maybe this should be explained before teaching the user to create
schemas...

=E2=80=8BThe assumption of there not being a username schema is implicit he=
re and
everything works if that is true.  But the most of this could be better
written to either directly account for the username schema or separately
explain the interaction when one is present.

=E2=80=8BRoom for improvement but not exactly critical.

David J.

Re: BUG #13583: Documentation "5.8.2. The Public Schema" misleading

От
Tom Lane
Дата:
"David G. Johnston" <david.g.johnston@gmail.com> writes:
> So basically the key phrase in that paragraph is "by default".  The reader
> is intended to take that to mean "with only the schemas created by initdb".

There are actually three assumptions underlying "by default":
1. You haven't changed the default search_path setting.
2. You haven't created a schema matching your own username.
3. You haven't removed the public schema.

The section after this one goes into these details.  I don't think that
explaining them all right here would be an improvement in readability.
You have to start somewhere ...

            regards, tom lane