PostgreSQL:使用“公共”模式名称访问关系

时间:2018-07-06 09:36:54

标签: postgresql quoted-identifier

使用PostgreSQL 9.6,我在公共模式下使用pgAdmin创建了新表。 但是要访问该表,我不能仅使用表名。如果我使用public。“ Book”,那么只能访问该表。

thrillio=# show search_path;
 search_path
-------------
 public
(1 row)

\ d +显示所有表。

thrillio=# \d+
                            List of relations
 Schema |       Name        | Type  |  Owner   |    Size    | Description
--------+-------------------+-------+----------+------------+-------------
 public | Book              | table | postgres | 8192 bytes |
 public | KidFriendlyStatus | table | postgres | 0 bytes    |
 public | Movie             | table | postgres | 8192 bytes |
 public | User              | table | postgres | 8192 bytes |
 public | Weblink           | table | postgres | 8192 bytes |
(5 rows)

 thrillio=# select * from Book;
ERROR:  relation "book" does not exist
LINE 1: select * from Book;
                      ^
thrillio=# select * from public."Book";
 id | title | profileUrl | publicationYear | publisher | authors | genre | amazonRating
----+-------+------------+-----------------+-----------+---------+-------+--------------
(0 rows)

这是预期的吗?我需要更改search_path来解决此问题吗?

0 个答案:

没有答案