Re: No relations found?

From: Joe Conway <mail(at)joeconway(dot)com>
To: Mikael Carneholm <SA9625(at)ida(dot)utb(dot)hb(dot)se>
Cc: pgsql-general(at)postgresql(dot)org
Subject: Re: No relations found?
Date: 2002-12-07 15:49:59
Message-ID: 3DF218A7.2070109@joeconway.com
Views: Raw Message | Whole Thread | Download mbox | Resend email
Thread:
Lists: pgsql-general

Mikael Carneholm wrote:
> After upgrading to the 7.3 version and putting one of my databases
> in a custom schema, I found out that the psql command
>
[snip]
>
> Strange, isn't it? I mean, shouldn't \d display all schemas &
> their tables in the current database?
>

No, it should display only the tables that are in the schemas in your
search_path. See:
http://developer.postgresql.org/docs/postgres/runtime-config.html
(SEARCH_PATH (string) near the bottom)

To see your current search_path:

regression=# show search_path;
search_path
--------------
$user,public
(1 row)

Here $user is a macro which evaluates to the logged in user name. To change
your search path for a particular session:

regression=# create schema foo;
CREATE SCHEMA
regression=# create table foo.bar(f1 int);
CREATE TABLE
regression=# \d bar;
Did not find any relation named "bar".
regression=# set search_path to 'foo','public';
SET
regression=# \d bar;
Table "foo.bar"
Column | Type | Modifiers
--------+---------+-----------
f1 | integer |

To change the search path for all users and databases, change search_path in
postgresql.conf. To change it persisently for one database, all users see the
ALTER DATABASE command:

regression=# ALTER DATABASE regression SET search_path TO 'foo','public';
ALTER DATABASE

To change the search path persisently for one user, see the ALTER USER command:
regression=# ALTER USER user1 SET search_path TO 'foo','public';
ALTER USER

HTH,

Joe

In response to

Browse pgsql-general by date

  From Date Subject
Next Message CSN 2002-12-07 18:14:35 Re: createlang fails
Previous Message Joe Conway 2002-12-07 15:34:55 Re: native command-line console for Windows