aboutsummaryrefslogtreecommitdiff
path: root/src
diff options
context:
space:
mode:
authorTom Lane <tgl@sss.pgh.pa.us>2020-01-19 16:04:36 -0500
committerTom Lane <tgl@sss.pgh.pa.us>2020-01-19 16:04:36 -0500
commit9c679a08f0cdedcf7f084daea3cba6ae9c3cbced (patch)
tree5adeacdf529b9b2694d93d4d02c5d7f584b44fd8 /src
parent7aaefadaac6452b2e813fae4ea531cb12d022531 (diff)
downloadpostgresql-9c679a08f0cdedcf7f084daea3cba6ae9c3cbced.tar.gz
postgresql-9c679a08f0cdedcf7f084daea3cba6ae9c3cbced.zip
Silence minor compiler warnings.
Ensure that ClassifyUtilityCommandAsReadOnly() has defined behavior even if TransactionStmt.kind has a value that's not one of the declared values for its enum. Suppress warnings from compilers that don't know that elog(ERROR) doesn't return, in ClassifyUtilityCommandAsReadOnly() and jsonb_set_lax(). Per Coverity and buildfarm.
Diffstat (limited to 'src')
-rw-r--r--src/backend/tcop/utility.c9
-rw-r--r--src/backend/utils/adt/jsonfuncs.c1
2 files changed, 7 insertions, 3 deletions
diff --git a/src/backend/tcop/utility.c b/src/backend/tcop/utility.c
index de84dd27a14..51925af6a05 100644
--- a/src/backend/tcop/utility.c
+++ b/src/backend/tcop/utility.c
@@ -129,7 +129,7 @@ CommandIsReadOnly(PlannedStmt *pstmt)
*
* Note the definitions of the relevant flags in src/include/utility/tcop.h.
*/
-int
+static int
ClassifyUtilityCommandAsReadOnly(Node *parsetree)
{
switch (nodeTag(parsetree))
@@ -359,7 +359,7 @@ ClassifyUtilityCommandAsReadOnly(Node *parsetree)
TransactionStmt *stmt = (TransactionStmt *) parsetree;
/*
- * PREPARE, COMMIT PREPARED, and ROLLBACK PREPARED all change
+ * PREPARE, COMMIT PREPARED, and ROLLBACK PREPARED all
* write WAL, so they're not read-only in the strict sense;
* but the first and third do not change pg_dump output, so
* they're OK in a read-only transactions.
@@ -383,12 +383,15 @@ ClassifyUtilityCommandAsReadOnly(Node *parsetree)
case TRANS_STMT_ROLLBACK_PREPARED:
return COMMAND_OK_IN_READ_ONLY_TXN;
}
+ elog(ERROR, "unrecognized TransactionStmtKind: %d",
+ (int) stmt->kind);
+ return 0; /* silence stupider compilers */
}
default:
elog(ERROR, "unrecognized node type: %d",
(int) nodeTag(parsetree));
- break;
+ return 0; /* silence stupider compilers */
}
}
diff --git a/src/backend/utils/adt/jsonfuncs.c b/src/backend/utils/adt/jsonfuncs.c
index 4b5a0214dca..3c1a0319fe9 100644
--- a/src/backend/utils/adt/jsonfuncs.c
+++ b/src/backend/utils/adt/jsonfuncs.c
@@ -4456,6 +4456,7 @@ jsonb_set_lax(PG_FUNCTION_ARGS)
ereport(ERROR,
(errcode(ERRCODE_INVALID_PARAMETER_VALUE),
errmsg("need delete_key, return_target, use_json_null, or raise_exception")));
+ return (Datum) 0; /* silence stupider compilers */
}
}