From: | Stephan Szabo <sszabo(at)megazone23(dot)bigpanda(dot)com> |
---|---|
To: | David Olbersen <dave(at)slickness(dot)org> |
Cc: | pgsql-sql(at)postgresql(dot)org |
Subject: | Re: Don't want blank data |
Date: | 2001-01-25 20:43:24 |
Message-ID: | Pine.BSF.4.21.0101251241340.86017-100000@megazone23.bigpanda.com |
Views: | Raw Message | Whole Thread | Download mbox | Resend email |
Thread: | |
Lists: | 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)...
From | Date | Subject | |
---|---|---|---|
Next Message | Mike D'Agosta | 2001-01-25 20:56:17 | Re: Is there anything like DESCRIBE? |
Previous Message | David Olbersen | 2001-01-25 20:13:54 | Re: Change or get currentdb |