Re: public schema doubt - Mailing list pgsql-general

From Scott Marlowe
Subject Re: public schema doubt
Date
Msg-id dcc563d10711160816n1d46bc7agb1f54c7b520e2831@mail.gmail.com
Whole thread Raw
In response to public schema doubt  (mailtolouis2020-postgres@yahoo.com)
List pgsql-general
On Nov 16, 2007 8:56 AM,  <mailtolouis2020-postgres@yahoo.com> wrote:
>
>
> Hello,
>
> I did a migration from 8.2.4 to 8.2.5,

Just FYI, from 8.2.4 to 8.2.5 doesn't require a dump / restore, you
can update minor versions in place.

> I used pg_dumpall to backup all the
> db and then restore it into 8.2.5. In my 8.2.4 db, I don't have public
> schema (it was dropped when I create the db, so only myschema is there), but
> when I restore to 8.2.5, I found that it created a public schema for me.

A freshly created database has a public schema by default, because it
is created form the template1 database which has a public schema.  If
you want a new database to have a different schema than public, you
can make that change to template1 and your new dbs will have that
setup.

> Should I just let the public schema there? Will it cause any problem?

Generally, no.

> In the
> postgres doc http://www.postgresql.org/docs/8.2/interactive/ddl-schemas.html
> (5.7.2) it said if I create a table without specify any schema name, it will
> put it into public schema, so I test it in my case, but it not doing it, the
> table is create under myschema, strange. And I check the search_path, it
> show "$user",public .

Then the user you're creating the table with has a different
search_path set than the default one of 'public',$user.  Most likely
the result of an alter user command.  Could also be an alter database
command.

pgsql-general by date:

Previous
From: Erik Jones
Date:
Subject: Re: getting the number of rows affected by a query
Next
From: "Scott Marlowe"
Date:
Subject: Re: Substitute column in SELECT with static value?