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 14:34:18 |
Message-ID: | 20040624072023.H88508@megazone.bigpanda.com |
Views: | Raw Message | Whole Thread | Download mbox | Resend email |
Thread: | |
Lists: | pgsql-sql |
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.
From | Date | Subject | |
---|---|---|---|
Next Message | Michael Glaesemann | 2004-06-24 15:51:58 | Re: feature request ? |
Previous Message | Stephan Szabo | 2004-06-24 14:00:32 | Re: feature request ? |