Consider a DB where there is a column tags which is a TEXT[]:
Using double quotes:
UPDATE my_table SET tags = tags || '{"na"}' WHERE name = 'Cat';
Using no quotes:
UPDATE my_table SET tags = tags || '{na}' WHERE name = 'Cat';
Both cases will update a row where name == Cat and append a string "na" to the list of tags. Is there a practical difference between these two methods?
>Solution :
No, there isn’t:
SELECT '{na}'::text[] = '{"na"}'::text[];
?column?
══════════
t
(1 row)
You need the double quotes only as an escape character if the array element contains a {, } or , character.