Re: why schema name is same as username behaves different

Поиск
Список
Период
Сортировка
От Joe Conway
Тема Re: why schema name is same as username behaves different
Дата
Msg-id 3DEFE4CF.9070301@joeconway.com
обсуждение исходный текст
Ответ на why schema name is same as username behaves different then others  (Jie Liang <jie@stbernard.com>)
Список 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 по дате отправления:

Предыдущее
От: Peter Eisentraut
Дата:
Сообщение: Re: list schema
Следующее
От: Jie Liang
Дата:
Сообщение: Re: why schema name is same as username behaves different then ot