54

这是我目前的状态。

Eonil=# \d+
                       List of relations
 Schema |    Name    | Type  | Owner |    Size    | Description 
--------+------------+-------+-------+------------+-------------
 public | TestTable1 | table | Eonil | 8192 bytes | 
(1 row)

Eonil=# \d+ TestTable1
Did not find any relation named "TestTable1".
Eonil=# 

有什么问题,如何查看表定义?

4

1 回答 1

89

Postgres psql 需要转义大写字母。

Eonil=# \d+ "TestTable1"

所以这很好用。

Eonil=# \d+ "TestTable1"
                   Table "public.TestTable1"
 Column |       Type       | Modifiers | Storage  | Description 
--------+------------------+-----------+----------+-------------
 ID     | bigint           | not null  | plain    | 
 name   | text             |           | extended | 
 price  | double precision |           | plain    | 
Indexes:
    "TestTable1_pkey" PRIMARY KEY, btree ("ID")
    "TestTable1_name_key" UNIQUE CONSTRAINT, btree (name)
Has OIDs: no

Eonil=# 
于 2013-03-06T02:46:31.207 回答