0

I tired to update the value for the languages EN and DE into the field introduction of table landingpage.

UPDATE landingpage 
  SET introduction = introduction::jsonb || '{"EN":"#1","DE":"#2"}' 
WHERE id = 5;

But I got alway the error:

Your query contains UPDATEs and/or DELETEs without a WHERE clause.

I tried to convert the octothorpe(#), for example:
1.UPDATE landingpage SET introduction = introduction::jsonb || '{"EN":"''#1","DE":"''#2"}' WHERE id = 5;
2.UPDATE landingpage SET introduction = introduction::jsonb || '{"EN":"'#1","DE":"'#2"}' WHERE id = 5;
3.UPDATE landingpage SET introduction = introduction::jsonb || '{"EN":"##1","DE":"##2"}' WHERE id = 5;
But they don't work.

I think the problem with the octothorpe(#). But how could I convert the octothorpe sign for updating the value?

WaYi1688
  • 1
  • 1
  • That's not a Postgres error message but some error from your SQL client. It seems that SQL client thinks that `#` is some special character which is completely wrong. Your SQL code is [perfectly fine](https://dbfiddle.uk/MmlR01Gz) –  Nov 18 '22 at 14:07
  • @a_horse_with_no_name thank so much for your anwser! That was because of the SQL client HeidiSQL. In pgAdmin4 no problem :) – WaYi1688 Nov 18 '22 at 14:19
  • I wonder if HeidiSQL stupidly thinks that `#` is a comment –  Nov 18 '22 at 14:33
  • Indeed, my logic wrongly detects such strings as comments. I will try to fix that. But please note that message is clearly a confirmation dialog, not an error. You are just asked if you want to run the query anyway. If you feel that confirm dialog is too stupid you can disable it in Preferences > SQL. – Anse Nov 19 '22 at 12:07

0 Answers0