为什么psql找不到现有表的关系名?

时间:2013-03-06 02:45:23

标签: postgresql schema psql

下面'我现在的状态。

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=# 

问题是什么?如何查看表格定义?

1 个答案:

答案 0 :(得分:38)

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=#