Postgresql Column "Name" Does Not Exist

I’m new to Postgres and was getting the error: column Mike's restaurant does not exist when I tried to make a simple insert query. It turns out that Postgres interprets queries with double quotes differently. So replace double quotes with single quotes:

--temp.sql
-- Before
\c test; -- = use database, but in postgres
INSERT INTO restaurants(name, website, phone)
    VALUES
    ("Mike's restaurant", "michael1e.com", "408-555-5555"); 

-- After
\c test;
INSERT INTO restaurants(name, website, phone)
    VALUES
    --replace the double quotes
    ('Mike's restaurant', 'michael1e.com', '408-555-5555'); 

I also found out that equivalent of use database is \c database.

Show Comments