X-Original-To: pgsql-sql-postgresql.org@localhost.postgresql.org Received: from localhost (unknown [200.46.204.144]) by svr1.postgresql.org (Postfix) with ESMTP id A8BBCD1B37D for ; Thu, 24 Jun 2004 10:25:07 -0300 (ADT) Received: from svr1.postgresql.org ([200.46.204.71]) by localhost (av.hub.org [200.46.204.144]) (amavisd-new, port 10024) with ESMTP id 57145-01 for ; Thu, 24 Jun 2004 13:25:07 +0000 (GMT) Received: from megazone.bigpanda.com (megazone.bigpanda.com [64.147.171.210]) by svr1.postgresql.org (Postfix) with ESMTP id 76951D1B1BC for ; Thu, 24 Jun 2004 10:25:02 -0300 (ADT) Received: by megazone.bigpanda.com (Postfix, from userid 1001) id CEBD23582F; Thu, 24 Jun 2004 06:25:05 -0700 (PDT) Received: from localhost (localhost [127.0.0.1]) by megazone.bigpanda.com (Postfix) with ESMTP id CD42D3578C; Thu, 24 Jun 2004 06:25:05 -0700 (PDT) Date: Thu, 24 Jun 2004 06:25:05 -0700 (PDT) From: Stephan Szabo To: sad Cc: "Gregory S. Williamson" , pgsql-sql@postgresql.org Subject: Re: feature request ? In-Reply-To: <200406241104.15265.sad@bankir.ru> Message-ID: <20040624062119.Q87012@megazone.bigpanda.com> References: <71E37EF6B7DCC1499CEA0316A256832801057B7C@loki.wc.globexplorer.net> <200406241104.15265.sad@bankir.ru> MIME-Version: 1.0 Content-Type: TEXT/PLAIN; charset=US-ASCII X-Virus-Scanned: by amavisd-new at hub.org X-Spam-Status: No, hits=0.0 tagged_above=0.0 required=5.0 tests= X-Spam-Level: X-Archive-Number: 200406/230 X-Sequence-Number: 18175 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.