0

Using PostgreSQL 9.6, I created new table using pgAdmin under public schema. But to access the table, I can't use just the table name. If I use public."Book" then only the table is accessible.

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

\d+ shows all the tables..

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)

is this expected? Anything I need to change the search_path to fix this?

Pradeep
  • 1,057
  • 2
  • 9
  • 17
  • `Book` and `"Book"` are two different identifiers [as explained in the manual](https://www.postgresql.org/docs/current/static/sql-syntax-lexical.html#SQL-SYNTAX-IDENTIFIERS). You need to use `select * from "Book"` –  Jul 06 '18 at 10:03
  • Alright, pgAdmin tool creating the relation name with the quotes. – Pradeep Jul 06 '18 at 10:26

0 Answers0