Re: [HACKERS] CASE construct

From: Bruce Momjian <maillist(at)candle(dot)pha(dot)pa(dot)us>
To: lockhart(at)alumni(dot)caltech(dot)edu (Thomas G(dot) Lockhart)
Cc: hackers(at)postgreSQL(dot)org
Subject: Re: [HACKERS] CASE construct
Date: 1998-11-13 10:50:34
Message-ID: 199811131050.FAA05876@candle.pha.pa.us
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? :)

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(at)candle(dot)pha(dot)pa(dot)us | (610) 853-3000
+ If your life is a hard drive, | 830 Blythe Avenue
+ Christ can be your backup. | Drexel Hill, Pennsylvania 19026

In response to

Browse pgsql-hackers by date

  From Date Subject
Next Message The Hermit Hacker 1998-11-13 13:00:14 Re: [HACKERS] More CORBA and PostgreSQL
Previous Message Michael Meskes 1998-11-13 10:32:38 lo_import problem