Re: [HACKERS] CASE construct

From: "Thomas G(dot) Lockhart" <lockhart(at)alumni(dot)caltech(dot)edu>
To: Bruce Momjian <maillist(at)candle(dot)pha(dot)pa(dot)us>
Cc: hackers(at)postgreSQL(dot)org
Subject: Re: [HACKERS] CASE construct
Date: 1998-11-13 06:52:50
Message-ID: 364BD742.A3585988@alumni.caltech.edu
Views: Raw Message | Whole Thread | Download mbox | Resend email
Thread:
Lists: pgsql-hackers

> > > 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

In response to

Responses

Browse pgsql-hackers by date

  From Date Subject
Next Message Cyrus Rahman 1998-11-13 07:00:39 Patches for FreeBSD/ELF
Previous Message Bruce Momjian 1998-11-13 06:30:19 Re: [HACKERS] CASE construct