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. ---------------------------(end of broadcast)--------------------------- TIP 5: Have you checked our extensive FAQ? http://www.postgresql.org/docs/faqs/FAQ.html