On Thu, 25 Jan 2001, David Olbersen wrote:

> Greetings,
>   Is there a way to have postgresql always return a value for each row
>   requested? To be more clear, if I were using a Perl SQL hybrid I would write
>   something like
> 
>   SELECT computer_ip or 'unset' FROM computers;
> 
>   So that if computers.computer_ip is NULL or '' I will get 'unset' back from
>   the database. I hope this makes sense and somebody can point me in a good
>   direction

Perhaps:
 select case when computer_ip is null or computer_ip='' then 'unset'::text
   else computer_ip end from computers;

(the ::text should probably be whatever type computer_ip is)...

Reply via email to