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

Re: plpgsql: Is ELSE IF supported or not?

From: Mark Mielke <mark(at)mark(dot)mielke(dot)cc>
To: Pavel Stehule <pavel(dot)stehule(at)gmail(dot)com>
Cc: 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 14:34:41
Message-ID: 4863A901.2060707@mark.mielke.cc (view raw or flat)
Thread:
Lists: pgsql-hackers
Pavel Stehule wrote:
> 2008/6/26 Marko Kreen <markokr(at)gmail(dot)com>:
>   
>> Although now that i read it more, the actual "form" is:
>>
>>  ELSE
>>     IF THEN
>>     END IF
>>  END IF;
>>
>> That is - the ELSE starts new block unconditionally and ignores any IF
>> that follows.  Later the IF can be part of new block as usual.  Huh.
>>
>> This is confusing.  I suggest removing the "ELSE IF" as one of the "forms"
>> because it is not.
>>     
>
> this is same in all procedural languages
>   

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:" ...

Cheers,
mark

-- 
Mark Mielke <mark(at)mielke(dot)cc>

In response to

Responses

pgsql-hackers by date

Next:From: Josh BerkusDate: 2008-06-26 14:43:39
Subject: Re: [0/4] Proposal of SE-PostgreSQL patches
Previous:From: Simon RiggsDate: 2008-06-26 14:20:37
Subject: get_relation_stats_hook()

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