Re: Don't want blank data - Mailing list pgsql-sql

From Stephan Szabo
Subject Re: Don't want blank data
Date
Msg-id Pine.BSF.4.21.0101251241340.86017-100000@megazone23.bigpanda.com
Whole thread Raw
In response to Don't want blank data  (David Olbersen <dave@slickness.org>)
List pgsql-sql
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)...



pgsql-sql by date:

Previous
From: David Olbersen
Date:
Subject: Re: Change or get currentdb
Next
From: Michael Davis
Date:
Subject: RE: Is there anything like DESCRIBE?