Thread: newbie question

newbie question

From
"Said Badrul Nahar"
Date:

I’m new with postgresql. How can i show table name and db name in postgresql like SHOW TABLE and SHOW DATABASE in MySQL.

 

Thanks

Said Badrul Nahar

 

Re: newbie question

From
"Dr. Evil"
Date:
> I'm new with postgresql. How can i show table name and db name in
> postgresql like SHOW TABLE and SHOW DATABASE in MySQL.

The equivalent of SHOW TABLE foo; in pg would be:

\d foo

Note that there is no ; at the end of that command.

I'm not sure what's equivalent to SHOW DATABASE.

Re: newbie question

From
"Aasmund Midttun Godal"
Date:
just \d

...


On 5 Nov 2001 00:43:45 -0000, "Dr. Evil" <drevil@sidereal.kz> wrote:
>
> The equivalent of SHOW TABLE foo; in pg would be:
>
> \d foo
>
> Note that there is no ; at the end of that command.
>
> I'm not sure what's equivalent to SHOW DATABASE.
>
> ---------------------------(end of broadcast)---------------------------
> TIP 6: Have you searched our list archives?
>
> http://archives.postgresql.org

Aasmund Midttun Godal

aasmund@godal.com - http://www.godal.com/
+47 40 45 20 46

Re: newbie question

From
missive@frontiernet.net (Lee Harr)
Date:
> I'm new with postgresql. How can i show table name and db name in
> postgresql like SHOW TABLE and SHOW DATABASE in MySQL.
>

In psql:

\d
\l
\?


to show:
tables
databases
other backslash commands



Re: newbie question

From
"Aasmund Midttun Godal"
Date:
erm, sorry, if you wanna see all the databases you can always:

SELECT datname FROM pg_database;

On Mon, 05 Nov 2001 01:27:29 GMT, "Aasmund Midttun Godal" <postgresql@envisity.com> wrote:
> just \d
>
> ...
>
>
> On 5 Nov 2001 00:43:45 -0000, "Dr. Evil" <drevil@sidereal.kz> wrote:
>
> Aasmund Midttun Godal
>
> aasmund@godal.com - http://www.godal.com/
> +47 40 45 20 46
>
> ---------------------------(end of broadcast)---------------------------
> TIP 5: Have you checked our extensive FAQ?
>
> http://www.postgresql.org/users-lounge/docs/faq.html

Aasmund Midttun Godal

aasmund@godal.com - http://www.godal.com/
+47 40 45 20 46

Re: newbie question

From
"Roderick A. Anderson"
Date:
On 5 Nov 2001, Dr. Evil wrote:

> I'm not sure what's equivalent to SHOW DATABASE.

A SWAG would be \d, \di, and \dv.  Tables and sequences, indexes, and
views.


Rod
--
                      Let Accuracy Triumph Over Victory

                                                       Zetetic Institute
                                                        "David's Sling"
                                                         Marc Stiegler


Re: newbie question

From
Dmitry Tkach
Date:
You cannot do that in postgres - it can only see tables in the database you are currently connected to.
7.3 has notion of schema though - that lets you have tables with the same names in the same database, but different
'schemas'.

I hope, it helps..

Dima

sowbug wrote:
> I have been using mysql, but am switching to postgres.  Can someone
> tell me the proper syntax for associating a table with a particular
> database.  In mysql the syntax is databasename.table name, but have
> found out this doesn't work in postgres.  I have tables with the same
> names, but in different databases and need to specify which database
> to use within my sql. e.g:
> Mysql: select * from db.table;
> Pgsql: select * from db.table;//doesn't work!!
>
> What's the proper syntax??
>
> regards,
> Brian