Tenho uma tabela e preciso selecionar todas as linhas com valor vazio para o fk_fc_id
campo (como prelúdio para excluí-las),
Column | Type | Modifiers
---------------+-----------------------------+------------------------------------------------------------
di_timestamp | timestamp without time zone |
di_item_value | character varying(10) |
fk_fc_id | integer |
di_id | integer | not null default nextval('data_item_di_id_seq1'::regclass)
No entanto, isso não funciona,
# select fk_fc_id,di_timestamp,di_item_value from data_item where fk_fc_id="";
ERROR: zero-length delimited identifier at or near """"
LINE 1: ...di_timestamp,di_item_value from data_item where fk_fc_id="";
^
Tentar Null
também não funciona.
Se alguém tiver alguma sugestão de como resolver isso, ficarei muito grato.
Isso não é realmente relacionado à administração de banco de dados, nem é realmente sobre o PostgreSQL, mas como @foibs respondeu, você deve dar uma olhada em IS NULL :
Você tem que usar aspas simples: