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

Commit7bdf9b8

Browse files
committed
Fix GET DIAGNOSTICS for case of assignment to function's first variable.
An incorrect and entirely unnecessary "safety check" in exec_stmt_getdiag()caused the code to treat an assignment to a variable with dno zero as ano-op. Unfortunately, that's a perfectly valid dno. This has been brokensince GET DIAGNOSTICS was invented. It's not terribly surprising that thebug went unnoticed for so long, since in most cases you probably wouldn'tuse the function's first-created variable (normally its first parameter)as a GET DIAGNOSTICS target. Nonetheless, it's broken. Per bug #6551from Adam Buraczewski.
1 parent3bf25a2 commit7bdf9b8

File tree

1 file changed

+1
-9
lines changed

1 file changed

+1
-9
lines changed

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

Lines changed: 1 addition & 9 deletions
Original file line numberDiff line numberDiff line change
@@ -1418,17 +1418,9 @@ exec_stmt_getdiag(PLpgSQL_execstate *estate, PLpgSQL_stmt_getdiag *stmt)
14181418
foreach(lc,stmt->diag_items)
14191419
{
14201420
PLpgSQL_diag_item*diag_item= (PLpgSQL_diag_item*)lfirst(lc);
1421-
PLpgSQL_datum*var;
1421+
PLpgSQL_datum*var=estate->datums[diag_item->target];
14221422
boolisnull= false;
14231423

1424-
if (diag_item->target <=0)
1425-
continue;
1426-
1427-
var=estate->datums[diag_item->target];
1428-
1429-
if (var==NULL)
1430-
continue;
1431-
14321424
switch (diag_item->kind)
14331425
{
14341426
casePLPGSQL_GETDIAG_ROW_COUNT:

0 commit comments

Comments
 (0)

[8]ページ先頭

©2009-2025 Movatter.jp