Why psql can't find relation name for existing table?

eonil picture eonil · Mar 6, 2013 · Viewed 16.8k times · Source

Here' my current state.

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

What is the problem and how can I see the table definition?

Answer

eonil picture eonil · Mar 6, 2013

Postgres psql needs escaping for capital letters.

Eonil=# \d+ "TestTable1"

So this works well.

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