Search code examples
postgresqlsql-insertstring-constant

PSQL [error] - value being recognized as a column


I just started learning database a couple of days ago. I'm running into this problem where my value is being recognized as a column, and it's spitting out an error.

This is my News table:

id | bodyText | url |  createdAt | updatedAt 
----+----------+-----+-----------+-----------

this is the command I ran in psql:

INSERT INTO "News" ("bodyText") VALUES ("this is a test");

and this is the error I'm getting:

ERROR:  column "this is a test" does not exist
LINE 1: INSERT INTO "News" ("bodyText") VALUES ("this is a ...

I've tried removing the double quotes, adding it, doing it line by line, and so far I haven't come across an answer. Does anyone have an answer to this? Thanks in advance.


Solution

  • Try this:

    INSERT INTO "Notifications" ("bodyText") VALUES ('this is a test');