From: Joe Conway <mail@joeconway.com>
To: Jie Liang <jie@stbernard.com>
Cc: Bruce Momjian <pgman@candle.pha.pa.us>
Cc: Tom Lane <tgl@sss.pgh.pa.us>
Cc: pgsql-admin@postgresql.org
Subject: Re: why schema name is same as username behaves different
Date: Thu, 05 Dec 2002 15:44:15 -0800
Message-ID: <3DEFE4CF.9070301@joeconway.com> (raw)
In-Reply-To: <E7E213858379814A9AE48CA6754F5ECB1E192A@mail01.stbernard.com>
References: <E7E213858379814A9AE48CA6754F5ECB1E192A@mail01.stbernard.com>
Jie Liang wrote:
> ####I expect to see something like:
> List of relations
> Schema | Name | Type | Owner
> --------+------+-------+-------
> public | foo | table | robot
> t | foo | table | robot
That's because schema t is not in your search path. By default,
search path is:
regression=# show search_path ;
search_path
--------------
$user,public
(1 row)
So you are not seeing the table in schema foo. If you do:
regression=# create user robot;
CREATE USER
regression=# create schema t AUTHORIZATION robot;
CREATE SCHEMA
regression=# drop table foo;
DROP TABLE
regression=# create table foo(test text);
CREATE TABLE
regression=# create table t.foo(test text);
CREATE TABLE
regression=# \dt
List of relations
Schema | Name | Type | Owner
--------+--------+-------+----------
public | foo | table | postgres
public | table1 | table | postgres
public | table2 | table | postgres
(3 rows)
regression=# set search_path to 't','public';
SET
regression=# \dt
List of relations
Schema | Name | Type | Owner
--------+--------+-------+----------
public | table1 | table | postgres
public | table2 | table | postgres
t | foo | table | postgres
(3 rows)
The $user in the default search path allows user robot to automatically find
objects in schema robot first.
You can change the default search path for the installation in
postgresql.conf, or you can change in via ALTER DATABASE or ALTER USER to be
effective in just one database or for one user respectively.
HTH,
Joe
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-admin@postgresql.org
Cc: mail@joeconway.com, jie@stbernard.com, pgman@candle.pha.pa.us, tgl@sss.pgh.pa.us
Subject: Re: why schema name is same as username behaves different
In-Reply-To: <3DEFE4CF.9070301@joeconway.com>
References: <E7E213858379814A9AE48CA6754F5ECB1E192A@mail01.stbernard.com> <3DEFE4CF.9070301@joeconway.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