> > > 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? :)
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)
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).
- Tom