2023-04-13

TIL PostgreSQL

TIL: use double quotes for postgresql table name that is not all lowercase

Made postgresql database table from prisma schema

-- schema.prisma
model School {
	...
}
 
-- equivalent sql
CREATE TABLE "School" (
	...
);

Error when tried to query the database

schools=# select * from School;
ERROR:  relation "school" does not exist
LINE 1: select * from School;
                      ^

Fix

-- before
select * from School;
 
-- after
select * from "School";