Error: Column does not exist in postgresql for update [duplicate]

I am trying to insert a line of text into a column where that column is null. Error listed below. Any help is greatly appreciated

UPDATE public.meditech_ar_test4
SET filename = "text"
WHERE filename is null;

ERROR: column "text" does not exist: I am aware that column does not exist, I want to insert it into the field


Solution 1:

In Postgres, double quote stand for identifiers (such as table or column names). Here, you actually want a string literal, so you need single quotes:

UPDATE public.meditech_ar_test4
SET filename = 'text'
WHERE filename is null;

Some databases (namely, MySQL), tolerate double quotes for string literals, while using other characters for identifiers (in MySQL: backticks). However in that regard Postgres follows the rules of standard SQL, which defines double quotes for identifiers. You should just take the habit of always using single quotes for string literals (most databases do support that).