Logo Questions Linux Laravel Mysql Ubuntu Git Menu
 

Why does Postgres say column does not exist? [duplicate]

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");
like image 502
bmacrevolution Avatar asked Dec 08 '22 18:12

bmacrevolution


1 Answers

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');
like image 112
parlad Avatar answered Dec 10 '22 07:12

parlad