From: Stephan Szabo <sszabo@megazone.bigpanda.com>
To: sad <sad@bankir.ru>
Cc: Gregory S. Williamson <gsw@globexplorer.com>
Cc: pgsql-sql@postgresql.org
Subject: Re: feature request ?
Date: Thu, 24 Jun 2004 07:34:18 -0700 (PDT)
Message-ID: <20040624072023.H88508@megazone.bigpanda.com> (raw)
In-Reply-To: <200406241724.14810.sad@bankir.ru>
References: <71E37EF6B7DCC1499CEA0316A256832801057B7C@loki.wc.globexplorer.net>
<200406241655.26065.sad@bankir.ru>
<20040624065015.Y87012@megazone.bigpanda.com>
<200406241724.14810.sad@bankir.ru>
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.
Reply instructions:
You may reply publicly to this message via plain-text email
using any one of the following methods:
* Reply to all the recipients using the --to and --cc options:
reply via email
To: pgsql-sql@postgresql.org
Cc: sszabo@megazone.bigpanda.com, sad@bankir.ru, gsw@globexplorer.com
Subject: Re: feature request ?
In-Reply-To: <20040624072023.H88508@megazone.bigpanda.com>
* Save the following mbox file, import it into your mail client,
and reply-to-all from there: mbox
This inbox is served by DDX for PostgreSQL; see mirroring instructions
for how to clone and mirror all data and code used for this inbox