> > > > I've gotten part-way toward implementing a CASE construct...
> > I was meaning to reply to your first post, but was sick. The way I
> > usually do it is to look at some feature that already uses it, and
> > copy that.
> > For the executor, they are usually spread out in many files.
>
> Hope you're feeling better. How scary was the "Bruce-cam" the last few
> days? :)
Scary. I avoided it. It pops up a window when it is active, so no one
saw the scary-ness.
> I've concluded that I need to make some fixups in the optimizer to get a
> plan which knows about column references inside the CASE clause. In the
> meantime, I've got a rudimentary capability with constants:
>
> postgres=> select case
> postgres-> when 1 > 2 then 10
> postgres-> when 2 > 1 then 20
> postgres-> else 30
> postgres-> end;
> NOTICE: CASE/WHEN not yet implemented
> ?column?
> --------
> 20
> (1 row)
That is interesting.
>
> I'm working on matching up types between THEN/ELSE clauses at the parser
> stage, but will soon need to get back to trying to figure out the
> planner. If I stall out for too long I may just commit the changes to
> give someone else a chance to help out (existing features are not
> damaged, so it shouldn't hurt).
Sure. No problem. Advantage of two trees. (See Marc, I am learning.)
-- Bruce Momjian | http://www.op.net/~candle maillist@candle.pha.pa.us | (610)
853-3000+ If your life is a hard drive, | 830 Blythe Avenue + Christ can be your backup. | Drexel Hill,
Pennsylvania19026