I am running into some strange problem in PostgreSQL
$ sudo -u postgres psql Blogging
psql (10.10 (Ubuntu 10.10-0ubuntu0.18.04.1))
Type "help" for help.
Blogging=# \dt
List of relations
Schema | Name | Type | Owner
--------+-----------------------+-------+-------
public | Blogs | table | e
public | Posts | table | e
public | __EFMigrationsHistory | table | e
(3 rows)
Blogging=# select * from Blogs
Blogging-# ;
ERROR: relation "blogs" does not exist
LINE 1: select * from Blogs
^
The same problem occurs when I log in as the owner of the tables:
$ psql -U e Blogging
psql (10.10 (Ubuntu 10.10-0ubuntu0.18.04.1))
Type "help" for help.
Blogging=# \dt
List of relations
Schema | Name | Type | Owner
--------+-----------------------+-------+-------
public | Blogs | table | e
public | Posts | table | e
public | __EFMigrationsHistory | table | e
(3 rows)
Blogging=# select * from Blogs;
ERROR: relation "blogs" does not exist
I created the database when running my application which uses Entity Framework, following https://learn.microsoft.com/en-us/ef/core/get-started/?tabs=netcore-cli. But I had some problem with the application, not sure if they are related to my question here.
"Blogs"is a different name thanBlogshttps://www.postgresql.org/docs/current/sql-syntax-lexical.html#SQL-SYNTAX-IDENTIFIERS - don't create your tables using double quotes: https://wiki.postgresql.org/wiki/Don't_Do_This#Don.27t_use_upper_case_table_or_column_names – Jan 10 '20 at 06:56\dtshow the table names containing double quotes? I create"Blogs"by following https://learn.microsoft.com/en-us/ef/core/get-started/?tabs=netcore-cli#create-the-database, and how did it add double quotes in the table name? – Tim Jan 10 '20 at 07:00create table Blogs (...)it will be created in lowercase (as the link to the manual in my previous comment explains) – Jan 10 '20 at 07:02psqlthought it's obvious that quotes are needed. Other SQL clients might display that differently – Jan 10 '20 at 07:11