From: | Stephan Szabo <sszabo(at)megazone(dot)bigpanda(dot)com> |
---|---|
To: | sad <sad(at)bankir(dot)ru> |
Cc: | "Gregory S(dot) Williamson" <gsw(at)globexplorer(dot)com>, pgsql-sql(at)postgresql(dot)org |
Subject: | Re: feature request ? |
Date: | 2004-06-24 13:25:05 |
Message-ID: | 20040624062119.Q87012@megazone.bigpanda.com |
Views: | Raw Message | Whole Thread | Download mbox | Resend email |
Thread: | |
Lists: | pgsql-sql |
On Thu, 24 Jun 2004, sad wrote:
> > I don't see what your point is. That SQL is wrong ? Or that SQL is not "C"
> > ? Or that SQL is not a "programming language" ?
>
> Who said wrong ? who said SQL ?
>
> I thougth _WHY_
> the IF control structure has exactly two alternate blocks ?
> a BOOLEAN expression has exactly two possible values, that's why !
>
> Well
> in plpgsql we have tri-valued BOOL
>
> Every programmer asks "how a NULL value treated?"
> Now you treat NULLs as false. That's your point, but why ?
It doesn't treat NULLs as false, it treats them as not true.
There's a least surprise issue here, most people expect if's then block to
run when it is true and the else block to run when it is not true (which
is false for most systems and false and NULL for this form of tri-valued
logic.) If you were to add a NULL block you'd have to deal with things
like, if you only have a then and else, do you run the else on NULL or do
you do nothing? If you do nothing, what if you want the null and else to
be the same, do you add another way to specify that? If you do the else,
then the else stops making sense since it's sometimes false and sometimes
not true.
From | Date | Subject | |
---|---|---|---|
Next Message | Stephan Szabo | 2004-06-24 14:00:32 | Re: feature request ? |
Previous Message | sad | 2004-06-24 13:24:14 | Re: feature request ? |