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

Commit9c679a0

Browse files
committed
Silence minor compiler warnings.
Ensure that ClassifyUtilityCommandAsReadOnly() has defined behavioreven if TransactionStmt.kind has a value that's not one of thedeclared values for its enum.Suppress warnings from compilers that don't know that elog(ERROR)doesn't return, in ClassifyUtilityCommandAsReadOnly() andjsonb_set_lax().Per Coverity and buildfarm.
1 parent7aaefad commit9c679a0

File tree

2 files changed

+7
-3
lines changed

2 files changed

+7
-3
lines changed

‎src/backend/tcop/utility.c

Lines changed: 6 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -129,7 +129,7 @@ CommandIsReadOnly(PlannedStmt *pstmt)
129129
*
130130
* Note the definitions of the relevant flags in src/include/utility/tcop.h.
131131
*/
132-
int
132+
staticint
133133
ClassifyUtilityCommandAsReadOnly(Node*parsetree)
134134
{
135135
switch (nodeTag(parsetree))
@@ -359,7 +359,7 @@ ClassifyUtilityCommandAsReadOnly(Node *parsetree)
359359
TransactionStmt*stmt= (TransactionStmt*)parsetree;
360360

361361
/*
362-
* PREPARE, COMMIT PREPARED, and ROLLBACK PREPARED all change
362+
* PREPARE, COMMIT PREPARED, and ROLLBACK PREPARED all
363363
* write WAL, so they're not read-only in the strict sense;
364364
* but the first and third do not change pg_dump output, so
365365
* they're OK in a read-only transactions.
@@ -383,12 +383,15 @@ ClassifyUtilityCommandAsReadOnly(Node *parsetree)
383383
caseTRANS_STMT_ROLLBACK_PREPARED:
384384
returnCOMMAND_OK_IN_READ_ONLY_TXN;
385385
}
386+
elog(ERROR,"unrecognized TransactionStmtKind: %d",
387+
(int)stmt->kind);
388+
return0;/* silence stupider compilers */
386389
}
387390

388391
default:
389392
elog(ERROR,"unrecognized node type: %d",
390393
(int)nodeTag(parsetree));
391-
break;
394+
return0;/* silence stupider compilers */
392395
}
393396
}
394397

‎src/backend/utils/adt/jsonfuncs.c

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -4456,6 +4456,7 @@ jsonb_set_lax(PG_FUNCTION_ARGS)
44564456
ereport(ERROR,
44574457
(errcode(ERRCODE_INVALID_PARAMETER_VALUE),
44584458
errmsg("need delete_key, return_target, use_json_null, or raise_exception")));
4459+
return (Datum)0;/* silence stupider compilers */
44594460
}
44604461
}
44614462

0 commit comments

Comments
 (0)

[8]ページ先頭

©2009-2025 Movatter.jp