How to select all rows which have a field equal to {}

profile for Nikola at Stack Overflow, Q&A for professional and enthusiast programmers
I’m a big fan of Stack Overflow and I tend to contribute regularly (am currently in the top 0.X%). In this category (stackoverflow) of posts I will will be posting my top rated questions and answers. This, btw, is allowed as explained in the meta thread here.

My question was:

I see few rows like this in my table:

     id  | val
 --------+------------
    1    | {}
    2    | {}

Of course not all are equal to {}, and I would like to query them out and then update them to {0}. However, trying the following fails:

UPDATE table SET val={0} WHERE val={};

I must be missing something obvious, please point out what.

The answer, by user sandipon, was:

 

UPDATE table SET val='{0}' WHERE val='{}';
Written by Nikola Brežnjak