From: Neil Conway Date: Fri, 17 Dec 2004 03:51:36 +0000 (+0000) Subject: Allow 'ELSEIF' as an alternative to 'ELSIF' in PL/PgSQL. There have been X-Git-Url: http://git.postgresql.org/gitweb/static/gitweb.js?a=commitdiff_plain;h=5e567936bc2c2ee4307baf42cabde222bded5442;p=users%2Fbernd%2Fpostgres.git 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. --- diff --git a/doc/src/sgml/plpgsql.sgml b/doc/src/sgml/plpgsql.sgml index 0ed73481d7..52e7560ba9 100644 --- a/doc/src/sgml/plpgsql.sgml +++ b/doc/src/sgml/plpgsql.sgml @@ -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. + diff --git a/src/pl/plpgsql/src/scan.l b/src/pl/plpgsql/src/scan.l index fa494e31c2..22c0447d27 100644 --- a/src/pl/plpgsql/src/scan.l +++ b/src/pl/plpgsql/src/scan.l @@ -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; }