Welcome to ShenZhenJia Knowledge Sharing Community for programmer and developer-Open, Learning and Share
menu search
person
Welcome To Ask or Share your Answers For Others

Categories

So I made some tables programatically and I want to verify it's structure is what I think it is.

>Rocko=# c Rocko
Password for user Rocko:
psql (8.4.4, server 8.4.8)
You are now connected to database "Rocko".
Rocko=# d
            List of relations
 Schema |     Name     |   Type   | Owner
--------+--------------+----------+-------
 public | Email        | table    | Rocko
 public | Email_id_seq | sequence | Rocko
 public | Test         | table    | Rocko
 public | Test_id_seq  | sequence | Rocko
 public | User         | table    | Rocko
 public | User_id_seq  | sequence | Rocko
(6 rows)

So, for example, I want to see the columns in Test.

Rocko=# d Test

Did not find any relation named "Test".

Wait a minute?! Did not Test just show up under "List of Relations"? What's going on here?

See Question&Answers more detail:os

与恶龙缠斗过久,自身亦成为恶龙;凝视深渊过久,深渊将回以凝视…
thumb_up_alt 0 like thumb_down_alt 0 dislike
992 views
Welcome To Ask or Share your Answers For Others

1 Answer

PostgreSQL converts unquoted identifiers (such as table and column names) to lower case by default; the standard says that identifiers are supposed to be normalized to upper case but that's not important here. So, when you say this:

d Test

PostgreSQL considers that the same as d test. You probably have a table that was created with a quoted name:

create table "Test" ( ...

so that its name is case sensitive and must be quoted (with double quotes) every time it is referenced. So try quoting the name:

d "Test"

与恶龙缠斗过久,自身亦成为恶龙;凝视深渊过久,深渊将回以凝视…
thumb_up_alt 0 like thumb_down_alt 0 dislike
Welcome to ShenZhenJia Knowledge Sharing Community for programmer and developer-Open, Learning and Share
...