Allow 'ELSEIF' as an alternative to 'ELSIF' in PL/PgSQL. There have been
authorNeil Conway <[email protected]>
Fri, 17 Dec 2004 03:51:36 +0000 (03:51 +0000)
committerNeil Conway <[email protected]>
Fri, 17 Dec 2004 03:51:36 +0000 (03:51 +0000)
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.

doc/src/sgml/plpgsql.sgml
src/pl/plpgsql/src/scan.l

index 0ed73481d7285e97c3a4daa008c586483cc4c833..52e7560ba9489cb5e50c9559df0955c122b76cb6 100644 (file)
@@ -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">
index fa494e31c25eff7ed729ce64dbce9eb1cf6d3eb8..22c0447d27d62916a2aff941c2679cc25b6e7f2f 100644 (file)
@@ -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;           }