Re: Post Install / Secure PostgreSQL

From: Craig Ringer <craig(at)postnewspapers(dot)com(dot)au>
To: Carlos Mennens <carlos(dot)mennens(at)gmail(dot)com>
Cc: pgsql-general(at)postgresql(dot)org
Subject: Re: Post Install / Secure PostgreSQL
Date: 2010-09-15 23:26:18
Message-ID: 4C91561A.8040401@postnewspapers.com.au
Views: Raw Message | Whole Thread | Download mbox | Resend email
Thread:
Lists: pgsql-general

On 16/09/2010 2:10 AM, Carlos Mennens wrote:

> postgres=# SELECT * FROM pg_user;

> Doesn't that show I'm connected to the 'postgres' database and there
> is a table called 'pg_user' which holds all my PostgreSQL user info?
> That doesn't make sense to me if the database is empty unless I am
> missing something here. The only way I knew 'pg_user' was available
> was because I ran the command '\dS'.

pg_user is in the pg_catalog schema. The pg_catalog schema is not on the
default search_path so it is not shown by default in \dt etc. Again, see
the manual:

http://www.postgresql.org/docs/current/interactive/ddl-schemas.html

Since the pg_catalog schema is in all databases automatically, when we
say a database is "empty" what we really mean is that it contains only
the pg_catalog schema, a default "public" schema with no relations in
it, and no other schema.

It might help to think about the pg_catalog schema as somewhat like the
"mysql" database in MySQL in that it contains system information and is
used to control the database system's operation. However, unlike the
"mysql" database, you should never, EVER alter or edit it directly
unless you *really* know what you are doing. Always use the built-in
ALTER/CREATE/DROP commands.

I cannot recommend reading the PostgreSQL manual enough. It's pretty
comprehensive, well written (IMO) and will teach you about SQL in
general as well as PostgreSQL in particular.

--
Craig Ringer

Tech-related writing at http://soapyfrogs.blogspot.com/

In response to

Browse pgsql-general by date

  From Date Subject
Next Message Frank Ch. Eigler 2010-09-16 02:01:20 Re: Getting FATAL: terminating connection due to administrator command
Previous Message Scot Kreienkamp 2010-09-15 23:18:34 Re: help with error "unexpected pageaddr"