Se tutto ciò che vuoi mostrare è il letterale TRUE o FALSE , puoi utilizzare le dichiarazioni del caso come avevi proposto. Poiché PostgreSQL tratta TRUE , true , yes , on , y , t e 1 come vero, controllerei come vorrei che fosse l'output.
Dove la clausola può essere scritta come:
select * from tablename where active
--or--
select * from tablename where active = true
(La mia raccomandazione è la stessa di PostgreSQL:usa true)
Quando si seleziona, anche se potrebbe esserci esitazione a utilizzare le istruzioni case, consiglierei comunque di farlo per avere il controllo sulla stringa di output letterale.
La tua richiesta sarebbe simile a questa:
select
case when active = TRUE then 'TRUE' else 'FALSE' end as active_status,
...other columns...
from tablename
where active = TRUE;
Esempio SQLFiddle:https://sqlfiddle.com/#!15/4764d/1
create table test (id int, fullname varchar(100), active boolean);
insert into test values (1, 'test1', FALSE), (2, 'test2', TRUE), (3, 'test3', TRUE);
select
id,
fullname,
case when active = TRUE then 'TRUE' else 'FALSE' end as active_status
from test;
| id | fullname | active_status |
|----|----------|---------------|
| 1 | test1 | FALSE |
| 2 | test2 | TRUE |
| 3 | test3 | TRUE |