Received: from localhost (postgresql.org [64.49.215.8]) by postgresql.org (Postfix) with ESMTP id 815DA476CEE for ; Thu, 5 Dec 2002 19:46:07 -0500 (EST) Received: from joeconway.com (unknown [63.210.180.150]) by postgresql.org (Postfix) with ESMTP id 70BFF476E60 for ; Thu, 5 Dec 2002 18:45:49 -0500 (EST) Received: from [206.19.64.3] (account jconway HELO joeconway.com) by joeconway.com (CommuniGate Pro SMTP 3.5.9) with ESMTP-TLS id 1469729; Thu, 05 Dec 2002 16:25:36 -0800 Message-ID: <3DEFE4CF.9070301@joeconway.com> Date: Thu, 05 Dec 2002 15:44:15 -0800 From: Joe Conway User-Agent: Mozilla/5.0 (Windows; U; Windows NT 5.0; en-US; rv:1.2) Gecko/20021126 X-Accept-Language: en-us, en MIME-Version: 1.0 To: Jie Liang Cc: 'Bruce Momjian' , Tom Lane , pgsql-admin@postgresql.org Subject: Re: why schema name is same as username behaves different References: In-Reply-To: Content-Type: text/plain; charset=us-ascii; format=flowed Content-Transfer-Encoding: 7bit X-Virus-Scanned: by AMaViS new-20020517 X-Archive-Number: 200212/70 X-Sequence-Number: 6565 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