Allow 'ELSEIF' as an alternative to 'ELSIF' in PL/PgSQL. There have been
authorNeil Conway
Fri, 17 Dec 2004 03:51:36 +0000 (03:51 +0000)
committerNeil Conway
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 443d82f63f194c5af767c80131ac0f60e982cfbe..596ef7971fd3d1de7e55180dbc836d7be0508e9b 100644 (file)
@@ -1,5 +1,5 @@
 
 
  
@@ -1475,7 +1475,7 @@ SELECT * FROM some_func();
 
     
      IF statements let you execute commands based on
-     certain conditions.  PL/pgSQL has four forms of
+     certain conditions.  PL/pgSQL has five forms of
      IF:
     
      
@@ -1490,6 +1490,9 @@ SELECT * FROM some_func();
      
       IF ... THEN ... ELSIF ... THEN ... ELSE
      
+     
+      IF ... THEN ... ELSEIF ... THEN ... ELSE
+     
     
     
 
@@ -1633,6 +1636,13 @@ END IF;
 
        
      
+
+     
+      <literal>IF-THEN-ELSEIF-ELSE</>
+
+      
+       ELSEIF is an alias for ELSIF.
+     
    
 
    
index 9b2615df105185a63f8864546cd95d6a0dd3304a..5e92ba76905c5ab49d2df9d19f255053f56dceb7 100644 (file)
@@ -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;       }