How to change the default output format for boolean values In a Postgres database, I know how to use case statements to get only TRUE or FALSE for a boolean field but was wondering whether there is a cleaner way to set this up like changing any configuration in the db.

Update: in Postgres, a the boolean representation for true is not only TRUE but also: yes, y, on, "t". So, I am inserting values with value TRUE. However, the SELECT command returns those values as "t".
There is probably something that I don't understand about your question but given a table with a boolean attribute like:

create table T ( b boolean not null );


You can only insert True, False. Under what circumstances would you need a CASE expression?

Edit:

reading your comments above, I guess you are interested in a textual representation of t/f. Not sure if it fits your needs but you can cast it to text:

select b::text from T


If you want it to be TRUE/FALSE I guess you will have to:

select upper(b::text) from T


Perhaps a function would be cleaner?

CREATE FUNCTION showbool(boolean) RETURNS text
    AS $$ SELECT UPPER(CAST($1 AS text)) $$
    LANGUAGE SQL;

select showbool(b) from T