Re: [NOVICE] Simple list tables question

From: Ron St-Pierre <rstpierre(at)syscor(dot)com>
To: Mihai Tanasescu <Mihai(dot)Tanasescu(at)skyraven(dot)pcnet(dot)ro>, pgsql-general <pgsql-general(at)postgresql(dot)org>
Subject: Re: [NOVICE] Simple list tables question
Date: 2004-03-26 19:15:30
Message-ID: 40648152.8010804@syscor.com
Views: Raw Message | Whole Thread | Download mbox | Resend email
Thread:
Lists: pgsql-general pgsql-novice

Mihai Tanasescu wrote:

> Hello,
>
> I've been a mysql user for about 2 years and I decided to try Postgre
> SQL out.
>
> I have the following problem that I'm trying to figure out:
>
> - in mysql as user root I can connect to any databases not owned by
> myself and I can list the tables they contain
> - in postgre I have created another database owned by user "bbstatus"
> If I login with user bbstatus to database bbstatus then I can do a
> "\dt" and show the tables it contains but if I login with user
> postgres which is a superuser and I try a "\dt" I get no results.
>
> /usr/local/pgsql/bin/psql -U bbstatus bbstatus
> Welcome to psql 7.4.2, the PostgreSQL interactive terminal.
>
> Type: \copyright for distribution terms
> \h for help with SQL commands
> \? for help on internal slash commands
> \g or terminate with semicolon to execute query
> \q to quit
>
> bbstatus=> \dt
> List of relations
> Schema | Name | Type | Owner
> ----------+--------------------------------+-------+----------
> bbstatus | acct_clientip | table | bbstatus
> bbstatus | acct_clients_and_filters | table | bbstatus
>
>
>
> /usr/local/pgsql/bin/psql -U postgres bbstatus
> Welcome to psql 7.4.2, the PostgreSQL interactive terminal.
>
> Type: \copyright for distribution terms
> \h for help with SQL commands
> \? for help on internal slash commands
> \g or terminate with semicolon to execute query
> \q to quit
>
> bbstatus=# \dt
> No relations found.

This is looking for tables in your default schema, which is 'public'. If
you want tables in the bbstatus schema listed you have to tell it so:
bbstatus=# \dt bbstatus.
Note that you need to include the period at the end.

>
>
>
>
> Isn't the postgres user the same as the root user from mysql ?
> I mean there must be a user that has enough rights by default to list
> tables in any databases ( I don't like granting myself right for every
> database someone creates)
>
>
>
>
>
> ---------------------------(end of broadcast)---------------------------
> TIP 1: subscribe and unsubscribe commands go to majordomo(at)postgresql(dot)org
>
>
Ron

In response to

Browse pgsql-general by date

  From Date Subject
Next Message Tom Lane 2004-03-26 19:37:13 Re: simple join query runs very slowly
Previous Message Diogo Biazus 2004-03-26 19:11:44 Problem with memory in C function

Browse pgsql-novice by date

  From Date Subject
Next Message Tom Lane 2004-03-26 19:19:49 Re: Extract Function
Previous Message Stephan Szabo 2004-03-26 18:56:44 Re: Extract Function