How do I list all tables?
In 6.4.2 the "\?" output while in psql says that you can do "\d *" to
list all of the tables in a particular database. In 7.0.3, this is NOT
mentioned and the same syntax does NOT work. Is there another way to
mimic the results of this statement in 6.4.2? Thanks!
Keith C. Perry
http://vcsn.com
I think I might have described this wrong- "\dt" works the same in
version 6 and 7. However "\d *" shows you the detail of **each** table
in the database. So if you two tables called "status" and "tasks", the
output of "\d *" would be:
Table = status
+----------------------------------+----------------------------------+-------+
| Field | Type |
Length|
+----------------------------------+----------------------------------+-------+
| statid | int4
| 4 |
| flag | varchar()
| 80 |
| color | char()
| 6 |
+----------------------------------+----------------------------------+-------+
Table = tasks
+----------------------------------+----------------------------------+-------+
| Field | Type |
Length|
+----------------------------------+----------------------------------+-------+
| taskid | int4
| 4 |
| jid | int4
| 4 |
| conid | int4
| 4 |
| workdone | varchar()
| 800 |
| date | char()
| 10 |
+----------------------------------+----------------------------------+-------+
if these were the only tables in the database. Since version 7 of pgSQL
doesn't seem to support this, I would like to know what is the
alternative way to list all of the tables AND their field descriptions?
Thanks
cwz wrote:
Show quoted text
use \dt
Note:
\d{t|i|s|v} list tables/indices/sequences/views
\d{p|S|l} list permissions/system tables/lobjects
\da list aggregates
\dd [object] list comment for table, type, function, or operator
\df list functions
\do list operators
\dT list data typesCurt
If you want a graphical approach, try pgaccess for X interface. Its very
clean in displaying tables
Keith C. Perry wrote in message <3A790EDC.8D9B7D22@vcsn.com>...
I think I might have described this wrong- "\dt" works the same in
version 6 and 7. However "\d *" shows you the detail of **each** table
in the database. So if you two tables called "status" and "tasks", the
output of "\d *" would be:Table = status
+----------------------------------+----------------------------------+----
---+
| Field | Type |
Length|
+----------------------------------+----------------------------------+----
---+
| statid | int4
| 4 |
| flag | varchar()
| 80 |
| color | char()
| 6 |
+----------------------------------+----------------------------------+----
---+
Table = tasks
+----------------------------------+----------------------------------+----
---+
| Field | Type |
Length|
+----------------------------------+----------------------------------+----
---+
| taskid | int4
| 4 |
| jid | int4
| 4 |
| conid | int4
| 4 |
| workdone | varchar()
| 800 |
| date | char()
| 10 |
+----------------------------------+----------------------------------+----
---+
Show quoted text
if these were the only tables in the database. Since version 7 of pgSQL
doesn't seem to support this, I would like to know what is the
alternative way to list all of the tables AND their field descriptions?
Thankscwz wrote:
use \dt
Note:
\d{t|i|s|v} list tables/indices/sequences/views
\d{p|S|l} list permissions/system tables/lobjects
\da list aggregates
\dd [object] list comment for table, type, function, or operator
\df list functions
\do list operators
\dT list data typesCurt
On Wed, 31 Jan 2001, Keith Perry wrote:
In 6.4.2 the "\?" output while in psql says that you can do "\d *" to
list all of the tables in a particular database. In 7.0.3, this is NOT
mentioned and the same syntax does NOT work. Is there another way to
mimic the results of this statement in 6.4.2? Thanks!
\d with no arguments will list all tables.
-- Brett
http://www.chapelperilous.net/~bmccoy/
---------------------------------------------------------------------------
The human mind treats a new idea the way the body treats a strange
protein -- it rejects it.
-- P. Medawar