From: | Tom Lane <tgl(at)sss(dot)pgh(dot)pa(dot)us> |
---|---|
To: | Neil Conway <neilc(at)samurai(dot)com> |
Cc: | PostgreSQL-patches <pgsql-patches(at)postgresql(dot)org>, Rico Wind <rw(at)rico-wind(dot)dk>, pgsql-bugs(at)postgresql(dot)org |
Subject: | Re: plpgsql unreachable code (was BUG #1329: Bug in IF-ELSEIF-ELSE construct) |
Date: | 2004-11-27 17:43:53 |
Message-ID: | 26640.1101577433@sss.pgh.pa.us |
Views: | Raw Message | Whole Thread | Download mbox | Resend email |
Thread: | |
Lists: | pgsql-bugs pgsql-patches |
Neil Conway <neilc(at)samurai(dot)com> writes:
>> (BTW, another thing this example exposes is that we don't issue warnings
>> about trivially-dead-code, such as statements in a basic block that
>> follow a RETURN. This would probably be also worth doing.)
> Attached is a patch that implements this. Specifically, if there are any
> statements in the same block that follow a RETURN, EXIT (without
> condition) or RAISE EXCEPTION statement, we issue a warning at CREATE
> FUNCTION time:
I think it would be sufficient to warn about the statement immediately
following the RETURN, EXIT, etc. The way you've got it could easily
bury the user in a mass of warning messages that don't really convey
any extra information.
You could possibly give two alternative messages:
WARNING: assignment is unreachable, due to exit near line 6
WARNING: assignment and following statement(s) are unreachable, due to exit near line 6
but I'm not sure that's worth the trouble.
Also, you must use ereport not elog for any user-facing error messages,
because elog messages aren't candidates for translation.
regards, tom lane
From | Date | Subject | |
---|---|---|---|
Next Message | Tom Lane | 2004-11-27 17:55:09 | Re: BUG #1329: Bug in IF-ELSEIF-ELSE construct |
Previous Message | Troels Arvin | 2004-11-27 15:19:31 | Re: bug in information_schema? |
From | Date | Subject | |
---|---|---|---|
Next Message | Tom Lane | 2004-11-27 17:55:09 | Re: BUG #1329: Bug in IF-ELSEIF-ELSE construct |
Previous Message | Neil Conway | 2004-11-27 13:56:31 | plpgsql unreachable code (was BUG #1329: Bug in IF-ELSEIF-ELSE construct) |