Re: Don't want blank data

Поиск
Список
Период
Сортировка
От Stephan Szabo
Тема Re: Don't want blank data
Дата
Msg-id Pine.BSF.4.21.0101251241340.86017-100000@megazone23.bigpanda.com
обсуждение исходный текст
Ответ на Don't want blank data  (David Olbersen <dave@slickness.org>)
Список 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 по дате отправления:

Предыдущее
От: David Olbersen
Дата:
Сообщение: Re: Change or get currentdb
Следующее
От: Michael Davis
Дата:
Сообщение: RE: Is there anything like DESCRIBE?