aboutsummaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorNeil Conway <neilc@samurai.com>2004-12-17 03:51:36 +0000
committerNeil Conway <neilc@samurai.com>2004-12-17 03:51:36 +0000
commit480777e56cb56d16b91656dac505e6e664c3aad9 (patch)
tree9b836143f35a4b4a1f68881b90a762fdff3b22db
parentdfdae5d63cd0c7eb75fb419c61a5fd62c7e4b326 (diff)
downloadpostgresql-480777e56cb56d16b91656dac505e6e664c3aad9.tar.gz
postgresql-480777e56cb56d16b91656dac505e6e664c3aad9.zip
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.
-rw-r--r--doc/src/sgml/plpgsql.sgml14
-rw-r--r--src/pl/plpgsql/src/scan.l3
2 files changed, 14 insertions, 3 deletions
diff --git a/doc/src/sgml/plpgsql.sgml b/doc/src/sgml/plpgsql.sgml
index 443d82f63f1..596ef7971fd 100644
--- a/doc/src/sgml/plpgsql.sgml
+++ b/doc/src/sgml/plpgsql.sgml
@@ -1,5 +1,5 @@
<!--
-$PostgreSQL: pgsql/doc/src/sgml/plpgsql.sgml,v 1.51 2004/12/13 18:05:08 petere Exp $
+$PostgreSQL: pgsql/doc/src/sgml/plpgsql.sgml,v 1.52 2004/12/17 03:51:34 neilc Exp $
-->
<chapter id="plpgsql">
@@ -1475,7 +1475,7 @@ SELECT * FROM some_func();
<para>
<literal>IF</> statements let you execute commands based on
- certain conditions. <application>PL/pgSQL</> has four forms of
+ certain conditions. <application>PL/pgSQL</> has five forms of
<literal>IF</>:
<itemizedlist>
<listitem>
@@ -1490,6 +1490,9 @@ SELECT * FROM some_func();
<listitem>
<para><literal>IF ... THEN ... ELSIF ... THEN ... ELSE</></>
</listitem>
+ <listitem>
+ <para><literal>IF ... THEN ... ELSEIF ... THEN ... ELSE</></>
+ </listitem>
</itemizedlist>
</para>
@@ -1633,6 +1636,13 @@ END IF;
</programlisting>
</para>
</sect3>
+
+ <sect3>
+ <title><literal>IF-THEN-ELSEIF-ELSE</></title>
+
+ <para>
+ <literal>ELSEIF</> is an alias for <literal>ELSIF</>.
+ </para>
</sect2>
<sect2 id="plpgsql-control-structures-loops">
diff --git a/src/pl/plpgsql/src/scan.l b/src/pl/plpgsql/src/scan.l
index 9b2615df105..5e92ba76905 100644
--- a/src/pl/plpgsql/src/scan.l
+++ b/src/pl/plpgsql/src/scan.l
@@ -4,7 +4,7 @@
* procedural language
*
* IDENTIFICATION
- * $PostgreSQL: pgsql/src/pl/plpgsql/src/scan.l,v 1.37 2004/09/13 01:45:32 neilc Exp $
+ * $PostgreSQL: pgsql/src/pl/plpgsql/src/scan.l,v 1.38 2004/12/17 03:51:36 neilc Exp $
*
* This software is copyrighted by Jan Wieck - Hamburg.
*
@@ -144,6 +144,7 @@ declare { return K_DECLARE; }
default { return K_DEFAULT; }
diagnostics { return K_DIAGNOSTICS; }
else { return K_ELSE; }
+elseif { return K_ELSIF; }
elsif { return K_ELSIF; }
end { return K_END; }
exception { return K_EXCEPTION; }