I am trying to write a query that tells if a column named s in table a.t has its default value (which is a very big base64 string). So I tried:
SELECT 1 FROM a.t WHERE s = (
   SELECT column_default FROM information_schema.columns
   WHERE (table_schema, table_name, column_name) = ('a', 't', 's'))
   AND uname = 'joe';
Which didn't work, so I noticed that the result from information_schema.columns had some stuff on it that the regular query did not:
SELECT column_default FROM information_schema.columns
WHERE (table_schema, table_name, column_name) = ('a', 't', 's');
column_default | 'data:image/png;base64,iVBO...QmCC'::text
Vs.
SELECT s FROM a.t WHERE uname = 'joe';
s | data:image/png;base64,iVBO...QmCC
Note the lack of quotes and explicit cast.
Is this why it does not match? Column s is defined as type text.
How can I change my query so I can test for equality between the column value and its default?
 
     
    