Neil Conway <[EMAIL PROTECTED]> 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 ---------------------------(end of broadcast)--------------------------- TIP 1: subscribe and unsubscribe commands go to [EMAIL PROTECTED]