From: Heikki Linnakangas <hlinnakangas@vmware.com>
To: syxjxia@gmail.com
Cc: pgsql-bugs@postgresql.org
Subject: Re: BUG #8405: user can create a system table(eg, pg_class)
Date: Wed, 28 Aug 2013 18:27:11 +0300
Message-ID: <521E16CF.3040200@vmware.com> (raw)
In-Reply-To: <E1VEV4k-0006Q6-Fw@wrigleys.postgresql.org>
References: <E1VEV4k-0006Q6-Fw@wrigleys.postgresql.org>
List-Unsubscribe: <mailto:majordomo@postgresql.org?body=unsub%20pgsql-bugs>
On 28.08.2013 05:01, syxjxia@gmail.com wrote:
> postgres=# create table pg_class(a int);
> CREATE TABLE
> postgres=# insert into pg_class values (1);
> ERROR: null value in column "relnamespace" violates not-null constraint
> DETAIL: Failing row contains (1, null, null, null, null, null, null, null,
> null, null, null, null, null, null, null, null, null, null, null, null,
> null, null, null, null, null, null, null).
That's not a bug. The table created is in the public schema, while all
the system tables are in pg_catalog schema. Yes, it's possible to create
a table in another schema with the same name. To avoid hijacking
applications that access the system tables, pg_catalog is implicitly in
front of search_path, if it's not listed there explicitly. So when you
do the insert, it refers to pg_catalog.pg_class.
- Heikki
--
Sent via pgsql-bugs mailing list (pgsql-bugs@postgresql.org)
To make changes to your subscription:
http://www.postgresql.org/mailpref/pgsql-bugs
Reply instructions:
You may reply publicly to this message via plain-text email
using any one of the following methods:
* Reply to all the recipients from your mail client; the link fills in
the headers below: reply via email
Some clients, webmail especially, drop In-Reply-To and References from
a link, and the reply then starts a new thread: use the mbox below.
To: pgsql-bugs@postgresql.org
Cc: hlinnakangas@vmware.com, syxjxia@gmail.com
Subject: Re: BUG #8405: user can create a system table(eg, pg_class)
In-Reply-To: <521E16CF.3040200@vmware.com>
References: <E1VEV4k-0006Q6-Fw@wrigleys.postgresql.org> <521E16CF.3040200@vmware.com>
* Save the following mbox file, import it into your mail client,
and reply-to-all from there: mbox
This inbox is served by DDX for PostgreSQL; see mirroring instructions
for how to clone and mirror all data and code used for this inbox