Skip site navigation (1) Skip section navigation (2)

Re: BUG #1329: Bug in IF-ELSEIF-ELSE construct

From: Tom Lane <tgl(at)sss(dot)pgh(dot)pa(dot)us>
To: Neil Conway <neilc(at)samurai(dot)com>
Cc: pgsql-bugs(at)postgresql(dot)org
Subject: Re: BUG #1329: Bug in IF-ELSEIF-ELSE construct
Date: 2004-12-21 18:57:31
Message-ID: 24631.1103655451@sss.pgh.pa.us (view raw or flat)
Thread:
Lists: pgsql-bugspgsql-patches
Awhile back I wrote:
>> As long as you only do this in check_function_bodies mode it seems
>> safe enough.  One possible problem (if it's done towards the end of
>> parsing as you've suggested for dead-code checking) is that a syntax
>> error in a SQL statement might confuse the plpgsql parser into
>> misparsing statement boundaries, which could lead to a plpgsql parse
>> error much further down, such as a "missing END" at the end of the
>> function.  The error would be more useful if reported immediately
>> after the putative SQL statement is parsed.  Not sure if that's
>> hard or not.  (The same remark applies to dead code checking, now
>> that I think about it.)

A real-world example of why this would be useful can be seen at
http://archives.postgresql.org/pgsql-novice/2004-12/msg00223.php

The problem is a missing semicolon just before an IF construct.  If
the putative PERFORM were SQL-parsed right away, the user could see
what had been taken as the body of the PERFORM and would be able to
figure out his mistake.  If we continue plpgsql-parsing it's very
hard to see how we avoid generating an error that leads the user
to look in the wrong place.

			regards, tom lane

In response to

pgsql-bugs by date

Next:From: Daniel GraceDate: 2004-12-22 17:23:22
Subject: BUG #1354: psql.exe won't start on NTFS partition under some circumstances
Previous:From: Bruce MomjianDate: 2004-12-21 18:07:02
Subject: Re: Problems with "-w" option on pg_ctl.exe running as a windows

pgsql-patches by date

Next:From: Jim C. NasbyDate: 2004-12-21 22:17:17
Subject: Re: Bgwriter behavior
Previous:From: Bruce MomjianDate: 2004-12-21 18:07:02
Subject: Re: Problems with "-w" option on pg_ctl.exe running as a windows

Privacy Policy | About PostgreSQL
Copyright © 1996-2014 The PostgreSQL Global Development Group