Why does Postgres say column does not exist?

bmacrevolution picture bmacrevolution · Apr 28, 2017 · Viewed 9.3k times · Source

So I have been working on the following sql script and I can't seem to figure out why it keeps telling me that the data I am inserting is in a column that doesn't exist. Can anyone more experianced with Postgre help me out?

DROP SCHEMA pomodoro CASCADE;
CREATE SCHEMA pomodoro;
CREATE TABLE pomodoro.users
(
    uid smallint NOT NULL,
    username text NOT NULL,
    password text NOT NULL,
    weekly_goals bytea,
    CONSTRAINT users_pkey PRIMARY KEY (uid)
) WITH (OIDS=FALSE);

INSERT INTO pomodoro.users (uid, username,password)
VALUES (1,"dan","pass");

The error I am getting is:

INSERT INTO pomodoro.users (uid, username,password)
VALUES (1,"dan","pass");
psql:database-backup/start-script.sql:27: ERROR:  column "dan" does not exist
LINE 2: VALUES (1,"dan","pass");

Answer

parlad picture parlad · Apr 28, 2017

Double quotes are used to specify the column name , So you can insert like:

INSERT INTO pomodoro.users (uid, username,password) VALUES (1,'dan','pass');