Skip to content

Commit 480777e

Browse files
author
Neil Conway
committed
Allow 'ELSEIF' as an alternative to 'ELSIF' in PL/PgSQL. There have been
several reports of users being confused when they attempt to use ELSEIF and run into trouble due to PL/PgSQL's lax parser. The parser will be improved for 8.1, but we can fix most of the problem by allowing ELSEIF for now.
1 parent dfdae5d commit 480777e

File tree

2 files changed

+14
-3
lines changed

2 files changed

+14
-3
lines changed

doc/src/sgml/plpgsql.sgml

Lines changed: 12 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -1,5 +1,5 @@
11
<!--
2-
$PostgreSQL: pgsql/doc/src/sgml/plpgsql.sgml,v 1.51 2004/12/13 18:05:08 petere Exp $
2+
$PostgreSQL: pgsql/doc/src/sgml/plpgsql.sgml,v 1.52 2004/12/17 03:51:34 neilc Exp $
33
-->
44

55
<chapter id="plpgsql">
@@ -1475,7 +1475,7 @@ SELECT * FROM some_func();
14751475

14761476
<para>
14771477
<literal>IF</> statements let you execute commands based on
1478-
certain conditions. <application>PL/pgSQL</> has four forms of
1478+
certain conditions. <application>PL/pgSQL</> has five forms of
14791479
<literal>IF</>:
14801480
<itemizedlist>
14811481
<listitem>
@@ -1490,6 +1490,9 @@ SELECT * FROM some_func();
14901490
<listitem>
14911491
<para><literal>IF ... THEN ... ELSIF ... THEN ... ELSE</></>
14921492
</listitem>
1493+
<listitem>
1494+
<para><literal>IF ... THEN ... ELSEIF ... THEN ... ELSE</></>
1495+
</listitem>
14931496
</itemizedlist>
14941497
</para>
14951498

@@ -1633,6 +1636,13 @@ END IF;
16331636
</programlisting>
16341637
</para>
16351638
</sect3>
1639+
1640+
<sect3>
1641+
<title><literal>IF-THEN-ELSEIF-ELSE</></title>
1642+
1643+
<para>
1644+
<literal>ELSEIF</> is an alias for <literal>ELSIF</>.
1645+
</para>
16361646
</sect2>
16371647

16381648
<sect2 id="plpgsql-control-structures-loops">

src/pl/plpgsql/src/scan.l

Lines changed: 2 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -4,7 +4,7 @@
44
* procedural language
55
*
66
* IDENTIFICATION
7-
* $PostgreSQL: pgsql/src/pl/plpgsql/src/scan.l,v 1.37 2004/09/13 01:45:32 neilc Exp $
7+
* $PostgreSQL: pgsql/src/pl/plpgsql/src/scan.l,v 1.38 2004/12/17 03:51:36 neilc Exp $
88
*
99
* This software is copyrighted by Jan Wieck - Hamburg.
1010
*
@@ -144,6 +144,7 @@ declare { return K_DECLARE; }
144144
default { return K_DEFAULT; }
145145
diagnostics { return K_DIAGNOSTICS; }
146146
else { return K_ELSE; }
147+
elseif { return K_ELSIF; }
147148
elsif { return K_ELSIF; }
148149
end { return K_END; }
149150
exception { return K_EXCEPTION; }

0 commit comments

Comments
 (0)
pFad - Phonifier reborn

Pfad - The Proxy pFad of © 2024 Garber Painting. All rights reserved.

Note: This service is not intended for secure transactions such as banking, social media, email, or purchasing. Use at your own risk. We assume no liability whatsoever for broken pages.


Alternative Proxies:

Alternative Proxy

pFad Proxy

pFad v3 Proxy

pFad v4 Proxy