Re: why schema name is same as username behaves different - Mailing list pgsql-admin

From Joe Conway
Subject Re: why schema name is same as username behaves different
Date
Msg-id 3DEFE4CF.9070301@joeconway.com
Whole thread Raw
In response to why schema name is same as username behaves different then others  (Jie Liang <jie@stbernard.com>)
List pgsql-admin
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


pgsql-admin by date:

Previous
From: Peter Eisentraut
Date:
Subject: Re: list schema
Next
From: Jie Liang
Date:
Subject: Re: why schema name is same as username behaves different then ot