Postgresql Column “Name” Does Not Exist

August 21, 2013 — Leave a comment

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.

Mike

Posts Twitter Facebook

My name is Michael Le, and I am a web developer.

No Comments

Be the first to start the conversation.

Leave a Reply

This site uses Akismet to reduce spam. Learn how your comment data is processed.