Skip to content

Commit 928d022

Browse files
committed
Fix a few bogus statement type names in plpgsql error messages.
plpgsql's error location context messages ("PL/pgSQL function fn-name line line-no at stmt-type") would misreport a CONTINUE statement as being an EXIT, and misreport a MOVE statement as being a FETCH. These are clear bugs that have been there a long time, so back-patch to all supported branches. In addition, in 9.5 and HEAD, change the description of EXECUTE from "EXECUTE statement" to just plain EXECUTE; there seems no good reason why this statement type should be described differently from others that have a well-defined head keyword. And distinguish GET STACKED DIAGNOSTICS from plain GET DIAGNOSTICS. These are a bit more of a judgment call, and also affect existing regression-test outputs, so I did not back-patch into stable branches. Pavel Stehule and Tom Lane
1 parent d509560 commit 928d022

File tree

1 file changed

+2
-2
lines changed

1 file changed

+2
-2
lines changed

src/pl/plpgsql/src/pl_funcs.c

+2-2
Original file line numberDiff line numberDiff line change
@@ -235,7 +235,7 @@ plpgsql_stmt_typename(PLpgSQL_stmt *stmt)
235235
case PLPGSQL_STMT_FOREACH_A:
236236
return _("FOREACH over array");
237237
case PLPGSQL_STMT_EXIT:
238-
return "EXIT";
238+
return ((PLpgSQL_stmt_exit *) stmt)->is_exit ? "EXIT" : "CONTINUE";
239239
case PLPGSQL_STMT_RETURN:
240240
return "RETURN";
241241
case PLPGSQL_STMT_RETURN_NEXT:
@@ -255,7 +255,7 @@ plpgsql_stmt_typename(PLpgSQL_stmt *stmt)
255255
case PLPGSQL_STMT_OPEN:
256256
return "OPEN";
257257
case PLPGSQL_STMT_FETCH:
258-
return "FETCH";
258+
return ((PLpgSQL_stmt_fetch *) stmt)->is_move ? "MOVE" : "FETCH";
259259
case PLPGSQL_STMT_CLOSE:
260260
return "CLOSE";
261261
case PLPGSQL_STMT_PERFORM:

0 commit comments

Comments
 (0)