Hi 2015-08-17 23:46 GMT+02:00 Tom Lane <t...@sss.pgh.pa.us>:
> Jim Nasby <jim.na...@bluetreble.com> writes: > > On 8/17/15 9:48 AM, Tom Lane wrote: > >> I'm inclined to think that if we wanted to make this better, the way to > >> improve it would be to detect the error*at compile time*, and get rid of > >> this hack in plpgsql_exec_function altogether. > > > So split PLPGSQL_NSTYPE_LABEL into PLPGSQL_NSTYPE_BLOCK_LABEL and > > PLPGSQL_NSTYPE_LOOP_LABEL, and split opt_block_label and opt_label the > > same way? > > I think using two NSTYPE codes would probably be a pain because there are > numerous places that don't care about the distinction; it'd be better to > have a secondary attribute distinguishing these cases. (It looks like you > could perhaps reuse the "itemno" field for the purpose, since that seems > to be going unused in LABEL items.) > > You likely do need to split opt_block_label into two productions, since > that will be the easiest way to pass forward the knowledge of whether > it's being called from a loop or non-loop construct. > when I implemented this check in plpgsql_check I found another minor issue in CONTINUE statement - the typename is wrong Regards Pavel > > regards, tom lane > > > -- > Sent via pgsql-hackers mailing list (pgsql-hackers@postgresql.org) > To make changes to your subscription: > http://www.postgresql.org/mailpref/pgsql-hackers >
diff --git a/src/pl/plpgsql/src/pl_funcs.c b/src/pl/plpgsql/src/pl_funcs.c new file mode 100644 index 7b26970..7603441 *** a/src/pl/plpgsql/src/pl_funcs.c --- b/src/pl/plpgsql/src/pl_funcs.c *************** plpgsql_stmt_typename(PLpgSQL_stmt *stmt *** 235,241 **** case PLPGSQL_STMT_FOREACH_A: return _("FOREACH over array"); case PLPGSQL_STMT_EXIT: ! return "EXIT"; case PLPGSQL_STMT_RETURN: return "RETURN"; case PLPGSQL_STMT_RETURN_NEXT: --- 235,241 ---- case PLPGSQL_STMT_FOREACH_A: return _("FOREACH over array"); case PLPGSQL_STMT_EXIT: ! return ((PLpgSQL_stmt_exit *) stmt)->is_exit ? "EXIT" : "CONTINUE"; case PLPGSQL_STMT_RETURN: return "RETURN"; case PLPGSQL_STMT_RETURN_NEXT:
-- Sent via pgsql-hackers mailing list (pgsql-hackers@postgresql.org) To make changes to your subscription: http://www.postgresql.org/mailpref/pgsql-hackers