0

when I run this in terminal:

INSERT INTO signup (username, user_password) VALUES("John", "dqw1");

It gives me: ERROR: column "John" does not exist.

What could be the problem here? this doesn't even make sense, the column name is username. "John" is just a value, it shouldn't exist before.

1 Answers1

4

The issue is with the double quotes - postgres is interpreting them as "delimited identifiers" (i.e. the name of an object, such as a column in a table).

So instead of this:

INSERT INTO signup (username, user_password) VALUES("John", "dqw1");

Do this:

INSERT INTO signup (username, user_password) VALUES('John', 'dqw1');
Brendan Green
  • 11,676
  • 5
  • 44
  • 76
  • 1
    This is a FAQ - closing it as a duplicate would have been more useful. This behavior is dictated by the SQL standard. – Laurenz Albe Oct 13 '21 at 05:31