From: | "McCaffity, Ray (Contractor)" <McCaffityR(at)epg(dot)lewis(dot)army(dot)mil> |
---|---|
To: | 'Stephan Szabo' <sszabo(at)megazone23(dot)bigpanda(dot)com>, Lev Lvovsky <lists1(at)sonous(dot)com> |
Cc: | pgsql-general(at)postgresql(dot)org |
Subject: | Re: if !NULL ? |
Date: | 2002-05-17 18:17:49 |
Message-ID: | 9669B05099E9D411B6E400B0D0AA476C5C37FB@epg.lewis.army.mil |
Views: | Raw Message | Whole Thread | Download mbox | Resend email |
Thread: | |
Lists: | pgsql-general |
Is there a way to do to define a default value when doing this?
something like...
select distinct
uid ....stuff...
e.thingy AS Ifnull(ulk,description,'UNKNOWN'),
... more stuff ...
As I want to do is have a default value of "UNKNOWN" instead of null.
-----Original Message-----
From: Stephan Szabo [mailto:sszabo(at)megazone23(dot)bigpanda(dot)com]
Sent: Thursday, May 16, 2002 6:17 PM
To: Lev Lvovsky
Cc: pgsql-general(at)postgresql(dot)org
Subject: Re: [GENERAL] if !NULL ?
On Thu, 16 May 2002, Lev Lvovsky wrote:
>
> ok, so more odd-ball questions
>
> I have two columns in a table:
>
> bool_bill | billing_id
>
> one is a boolean that determines if we bill a customer, and the other one
> is NULL if we don't, and has a billing_id of that customer if we do. the
> billing_id uses a foreign key on the billing table to check that the
> billing_id exists.
>
> what I'd like to do is if bool_bill = y, then there has to be something in
> billing_id (automatically checked with the foreign key).
>
> again, do I need a function for this?
I think a table check constraint like:
(bool_bill=false or billing_id is not null)
will make billing_id not accept nulls when bool_bill is true.
---------------------------(end of broadcast)---------------------------
TIP 3: if posting/reading through Usenet, please send an appropriate
subscribe-nomail command to majordomo(at)postgresql(dot)org so that your
message can get through to the mailing list cleanly
From | Date | Subject | |
---|---|---|---|
Next Message | Mark Wong | 2002-05-17 18:38:28 | OSDL Introduces OSDL-DBT-1 |
Previous Message | Anna Dorofiyenko | 2002-05-17 18:00:33 | Postgres compared |