Movatterモバイル変換


[0]ホーム

URL:


Skip to content

Navigation Menu

Sign in
Appearance settings

Search code, repositories, users, issues, pull requests...

Provide feedback

We read every piece of feedback, and take your input very seriously.

Saved searches

Use saved searches to filter your results more quickly

Sign up
Appearance settings

Commitf184de3

Browse files
committed
Give a more specific error message if you try to COMMIT, ROLLBACK or COPY
FROM STDIN in PL/pgSQL. We alread did this for dynamic EXECUTE statements,ie. "EXECUTE 'COMMIT'", but not otherwise.
1 parent6c3c7b5 commitf184de3

File tree

1 file changed

+11
-0
lines changed

1 file changed

+11
-0
lines changed

‎src/pl/plpgsql/src/pl_exec.c

Lines changed: 11 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -2889,6 +2889,17 @@ exec_stmt_execsql(PLpgSQL_execstate *estate,
28892889
exec_set_found(estate, false);
28902890
break;
28912891

2892+
/* Some SPI errors deserve specific error messages */
2893+
caseSPI_ERROR_COPY:
2894+
ereport(ERROR,
2895+
(errcode(ERRCODE_FEATURE_NOT_SUPPORTED),
2896+
errmsg("cannot COPY to/from client in PL/pgSQL")));
2897+
caseSPI_ERROR_TRANSACTION:
2898+
ereport(ERROR,
2899+
(errcode(ERRCODE_FEATURE_NOT_SUPPORTED),
2900+
errmsg("cannot begin/end transactions in PL/pgSQL"),
2901+
errhint("Use a BEGIN block with an EXCEPTION clause instead.")));
2902+
28922903
default:
28932904
elog(ERROR,"SPI_execute_plan_with_paramlist failed executing query \"%s\": %s",
28942905
expr->query,SPI_result_code_string(rc));

0 commit comments

Comments
 (0)

[8]ページ先頭

©2009-2025 Movatter.jp