Skip site navigation (1) Skip section navigation (2)

Re: plpgsql: Is ELSE IF supported or not?

From: Tom Lane <tgl(at)sss(dot)pgh(dot)pa(dot)us>
To: Mark Mielke <mark(at)mark(dot)mielke(dot)cc>
Cc: Pavel Stehule <pavel(dot)stehule(at)gmail(dot)com>, Marko Kreen <markokr(at)gmail(dot)com>, Postgres Hackers <pgsql-hackers(at)postgresql(dot)org>
Subject: Re: plpgsql: Is ELSE IF supported or not?
Date: 2008-06-26 17:33:02
Message-ID: 18442.1214501582@sss.pgh.pa.us (view raw or flat)
Thread:
Lists: pgsql-hackers
Mark Mielke <mark(at)mark(dot)mielke(dot)cc> writes:
> I don't agree with this statement. In "all procedural languages", or 
> probably most, they usually make "ELSE IF" special, in that you don't 
> need to close the block twice as per above. The ELSE IF is not actually 
> special in PL/SQL, so it is not a special form. The "ELSE" can contain a 
> block, which contain any statement, including a nested IF statement. Why 
> not describe ELSE WHILE as well based upon the logic that ELSE IF is 
> valid? :-)

> Now, if it were to say "an alternative form of ELSEIF is to nest IF 
> statement like so:" ...

Yeah, that might be better.  I think the reason the text looks the way
it does is that we didn't have ELSEIF/ELSIF to start out with, and what
is now section 38.6.2.3 was originally an example of what you had to do
to work around that lack.  I agree that the current presentation is more
confusing than anything else.  ISTM documenting ELSEIF and ELSIF as
"separate forms" of IF is a bit over-the-top too.

			regards, tom lane

In response to

pgsql-hackers by date

Next:From: Tom LaneDate: 2008-06-26 17:42:49
Subject: Re: Join Removal/ Vertical Partitioning
Previous:From: Tom LaneDate: 2008-06-26 17:25:31
Subject: Re: proposal: to_ascii(bytea)

Privacy Policy | About PostgreSQL
Copyright © 1996-2014 The PostgreSQL Global Development Group