On Thu, 24 Jun 2004, sad wrote: > > then lots of currently perfectly correct > > programs break. If they're the same, then ELSE has different meanings > > depending on whether NULL is specified, and that's generally bad from an > > understanding the language standpoint. > > i've already thougth on this > new control structure needed > but the name of the IF is perfect %-)
I was thinking that something like Cs switch might work. There's still a question of the keywords because I don't like reusing case, but maybe something of the general form: case foo is true is false is null The general form looks more like: case <expression> [when <expression>] then <statements> [is (true | false | null)] then <statements> [else] <statements> end case With (unthoughtout) semantics like The case expression is evaluated once (although the below describes things in terms of expressions of the case expression, it is meant to be indicative of the intent not the actual implementation) Each when/is/else clause is evaluated in order as follows: For a when clause, if the value of the case expression is equal to the value of the when expression the statements are run and the case is ended. For an is clause, IS TRUE: if case expression IS TRUE is true then the statements are run and the case is ended IS FALSE: if case expression IS FALSE is true then the statements are run and the case is ended IS NULL: if case expression IS NULL is true then the statements are run and the case is ended For an else clause, run the statements (since no preceding condition has succeeded) This is basically an extension of the syntax and semantics of one of the case expression. I don't think the above works keyword-wise possibly, but it might be a reasonable starting point. ---------------------------(end of broadcast)--------------------------- TIP 9: the planner will ignore your desire to choose an index scan if your joining column's datatypes do not match