mirror of
https://github.com/postgres/postgres.git
synced 2025-04-20 00:42:27 +03:00
Remove excess parens in ereport() calls
Cosmetic cleanup, not worth backpatching. Discussion: https://postgr.es/m/20200129200401.GA6303@alvherre.pgsql Reviewed-by: Tom Lane, Michael Paquier
This commit is contained in:
parent
2520cf8c2a
commit
4e89c79a52
@ -93,7 +93,7 @@ convert_and_check_filename(text *arg, bool logAllowed)
|
|||||||
if (path_contains_parent_reference(filename))
|
if (path_contains_parent_reference(filename))
|
||||||
ereport(ERROR,
|
ereport(ERROR,
|
||||||
(errcode(ERRCODE_INSUFFICIENT_PRIVILEGE),
|
(errcode(ERRCODE_INSUFFICIENT_PRIVILEGE),
|
||||||
(errmsg("reference to parent directory (\"..\") not allowed"))));
|
errmsg("reference to parent directory (\"..\") not allowed")));
|
||||||
|
|
||||||
/*
|
/*
|
||||||
* Allow absolute paths if within DataDir or Log_directory, even
|
* Allow absolute paths if within DataDir or Log_directory, even
|
||||||
@ -104,12 +104,12 @@ convert_and_check_filename(text *arg, bool logAllowed)
|
|||||||
!path_is_prefix_of_path(Log_directory, filename)))
|
!path_is_prefix_of_path(Log_directory, filename)))
|
||||||
ereport(ERROR,
|
ereport(ERROR,
|
||||||
(errcode(ERRCODE_INSUFFICIENT_PRIVILEGE),
|
(errcode(ERRCODE_INSUFFICIENT_PRIVILEGE),
|
||||||
(errmsg("absolute path not allowed"))));
|
errmsg("absolute path not allowed")));
|
||||||
}
|
}
|
||||||
else if (!path_is_relative_and_below_cwd(filename))
|
else if (!path_is_relative_and_below_cwd(filename))
|
||||||
ereport(ERROR,
|
ereport(ERROR,
|
||||||
(errcode(ERRCODE_INSUFFICIENT_PRIVILEGE),
|
(errcode(ERRCODE_INSUFFICIENT_PRIVILEGE),
|
||||||
(errmsg("path must be in or below the current directory"))));
|
errmsg("path must be in or below the current directory")));
|
||||||
|
|
||||||
return filename;
|
return filename;
|
||||||
}
|
}
|
||||||
@ -124,7 +124,7 @@ requireSuperuser(void)
|
|||||||
if (!superuser())
|
if (!superuser())
|
||||||
ereport(ERROR,
|
ereport(ERROR,
|
||||||
(errcode(ERRCODE_INSUFFICIENT_PRIVILEGE),
|
(errcode(ERRCODE_INSUFFICIENT_PRIVILEGE),
|
||||||
(errmsg("only superuser may access generic file functions"))));
|
errmsg("only superuser may access generic file functions")));
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
||||||
@ -485,7 +485,7 @@ pg_logdir_ls(PG_FUNCTION_ARGS)
|
|||||||
if (!superuser())
|
if (!superuser())
|
||||||
ereport(ERROR,
|
ereport(ERROR,
|
||||||
(errcode(ERRCODE_INSUFFICIENT_PRIVILEGE),
|
(errcode(ERRCODE_INSUFFICIENT_PRIVILEGE),
|
||||||
(errmsg("only superuser can list the log directory"))));
|
errmsg("only superuser can list the log directory")));
|
||||||
|
|
||||||
return (pg_logdir_ls_internal(fcinfo));
|
return (pg_logdir_ls_internal(fcinfo));
|
||||||
}
|
}
|
||||||
@ -515,7 +515,7 @@ pg_logdir_ls_internal(FunctionCallInfo fcinfo)
|
|||||||
if (strcmp(Log_filename, "postgresql-%Y-%m-%d_%H%M%S.log") != 0)
|
if (strcmp(Log_filename, "postgresql-%Y-%m-%d_%H%M%S.log") != 0)
|
||||||
ereport(ERROR,
|
ereport(ERROR,
|
||||||
(errcode(ERRCODE_INVALID_PARAMETER_VALUE),
|
(errcode(ERRCODE_INVALID_PARAMETER_VALUE),
|
||||||
(errmsg("the log_filename parameter must equal 'postgresql-%%Y-%%m-%%d_%%H%%M%%S.log'"))));
|
errmsg("the log_filename parameter must equal 'postgresql-%%Y-%%m-%%d_%%H%%M%%S.log'")));
|
||||||
|
|
||||||
if (SRF_IS_FIRSTCALL())
|
if (SRF_IS_FIRSTCALL())
|
||||||
{
|
{
|
||||||
|
@ -116,7 +116,7 @@ plperl_to_hstore(PG_FUNCTION_ARGS)
|
|||||||
if (SvTYPE(in) != SVt_PVHV)
|
if (SvTYPE(in) != SVt_PVHV)
|
||||||
ereport(ERROR,
|
ereport(ERROR,
|
||||||
(errcode(ERRCODE_FEATURE_NOT_SUPPORTED),
|
(errcode(ERRCODE_FEATURE_NOT_SUPPORTED),
|
||||||
(errmsg("cannot transform non-hash Perl value to hstore"))));
|
errmsg("cannot transform non-hash Perl value to hstore")));
|
||||||
hv = (HV *) in;
|
hv = (HV *) in;
|
||||||
|
|
||||||
pcount = hv_iterinit(hv);
|
pcount = hv_iterinit(hv);
|
||||||
|
@ -235,11 +235,11 @@ SV_to_JsonbValue(SV *in, JsonbParseState **jsonb_state, bool is_elem)
|
|||||||
if (isinf(nval))
|
if (isinf(nval))
|
||||||
ereport(ERROR,
|
ereport(ERROR,
|
||||||
(errcode(ERRCODE_NUMERIC_VALUE_OUT_OF_RANGE),
|
(errcode(ERRCODE_NUMERIC_VALUE_OUT_OF_RANGE),
|
||||||
(errmsg("cannot convert infinity to jsonb"))));
|
errmsg("cannot convert infinity to jsonb")));
|
||||||
if (isnan(nval))
|
if (isnan(nval))
|
||||||
ereport(ERROR,
|
ereport(ERROR,
|
||||||
(errcode(ERRCODE_NUMERIC_VALUE_OUT_OF_RANGE),
|
(errcode(ERRCODE_NUMERIC_VALUE_OUT_OF_RANGE),
|
||||||
(errmsg("cannot convert NaN to jsonb"))));
|
errmsg("cannot convert NaN to jsonb")));
|
||||||
|
|
||||||
out.type = jbvNumeric;
|
out.type = jbvNumeric;
|
||||||
out.val.numeric =
|
out.val.numeric =
|
||||||
@ -260,7 +260,7 @@ SV_to_JsonbValue(SV *in, JsonbParseState **jsonb_state, bool is_elem)
|
|||||||
*/
|
*/
|
||||||
ereport(ERROR,
|
ereport(ERROR,
|
||||||
(errcode(ERRCODE_FEATURE_NOT_SUPPORTED),
|
(errcode(ERRCODE_FEATURE_NOT_SUPPORTED),
|
||||||
(errmsg("cannot transform this Perl type to jsonb"))));
|
errmsg("cannot transform this Perl type to jsonb")));
|
||||||
return NULL;
|
return NULL;
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
@ -380,7 +380,7 @@ PLyNumber_ToJsonbValue(PyObject *obj, JsonbValue *jbvNum)
|
|||||||
{
|
{
|
||||||
ereport(ERROR,
|
ereport(ERROR,
|
||||||
(errcode(ERRCODE_DATATYPE_MISMATCH),
|
(errcode(ERRCODE_DATATYPE_MISMATCH),
|
||||||
(errmsg("could not convert value \"%s\" to jsonb", str))));
|
errmsg("could not convert value \"%s\" to jsonb", str)));
|
||||||
}
|
}
|
||||||
PG_END_TRY();
|
PG_END_TRY();
|
||||||
|
|
||||||
@ -394,7 +394,7 @@ PLyNumber_ToJsonbValue(PyObject *obj, JsonbValue *jbvNum)
|
|||||||
if (numeric_is_nan(num))
|
if (numeric_is_nan(num))
|
||||||
ereport(ERROR,
|
ereport(ERROR,
|
||||||
(errcode(ERRCODE_NUMERIC_VALUE_OUT_OF_RANGE),
|
(errcode(ERRCODE_NUMERIC_VALUE_OUT_OF_RANGE),
|
||||||
(errmsg("cannot convert NaN to jsonb"))));
|
errmsg("cannot convert NaN to jsonb")));
|
||||||
|
|
||||||
jbvNum->type = jbvNumeric;
|
jbvNum->type = jbvNumeric;
|
||||||
jbvNum->val.numeric = num;
|
jbvNum->val.numeric = num;
|
||||||
@ -446,8 +446,8 @@ PLyObject_ToJsonbValue(PyObject *obj, JsonbParseState **jsonb_state, bool is_ele
|
|||||||
else
|
else
|
||||||
ereport(ERROR,
|
ereport(ERROR,
|
||||||
(errcode(ERRCODE_FEATURE_NOT_SUPPORTED),
|
(errcode(ERRCODE_FEATURE_NOT_SUPPORTED),
|
||||||
(errmsg("Python type \"%s\" cannot be transformed to jsonb",
|
errmsg("Python type \"%s\" cannot be transformed to jsonb",
|
||||||
PLyObject_AsString((PyObject *) obj->ob_type)))));
|
PLyObject_AsString((PyObject *) obj->ob_type))));
|
||||||
|
|
||||||
/* Push result into 'jsonb_state' unless it is raw scalar value. */
|
/* Push result into 'jsonb_state' unless it is raw scalar value. */
|
||||||
return (*jsonb_state ?
|
return (*jsonb_state ?
|
||||||
|
@ -52,7 +52,7 @@ brin_page_type(PG_FUNCTION_ARGS)
|
|||||||
if (!superuser())
|
if (!superuser())
|
||||||
ereport(ERROR,
|
ereport(ERROR,
|
||||||
(errcode(ERRCODE_INSUFFICIENT_PRIVILEGE),
|
(errcode(ERRCODE_INSUFFICIENT_PRIVILEGE),
|
||||||
(errmsg("must be superuser to use raw page functions"))));
|
errmsg("must be superuser to use raw page functions")));
|
||||||
|
|
||||||
raw_page_size = VARSIZE(raw_page) - VARHDRSZ;
|
raw_page_size = VARSIZE(raw_page) - VARHDRSZ;
|
||||||
|
|
||||||
@ -141,7 +141,7 @@ brin_page_items(PG_FUNCTION_ARGS)
|
|||||||
if (!superuser())
|
if (!superuser())
|
||||||
ereport(ERROR,
|
ereport(ERROR,
|
||||||
(errcode(ERRCODE_INSUFFICIENT_PRIVILEGE),
|
(errcode(ERRCODE_INSUFFICIENT_PRIVILEGE),
|
||||||
(errmsg("must be superuser to use raw page functions"))));
|
errmsg("must be superuser to use raw page functions")));
|
||||||
|
|
||||||
/* check to see if caller supports us returning a tuplestore */
|
/* check to see if caller supports us returning a tuplestore */
|
||||||
if (rsinfo == NULL || !IsA(rsinfo, ReturnSetInfo))
|
if (rsinfo == NULL || !IsA(rsinfo, ReturnSetInfo))
|
||||||
@ -336,7 +336,7 @@ brin_metapage_info(PG_FUNCTION_ARGS)
|
|||||||
if (!superuser())
|
if (!superuser())
|
||||||
ereport(ERROR,
|
ereport(ERROR,
|
||||||
(errcode(ERRCODE_INSUFFICIENT_PRIVILEGE),
|
(errcode(ERRCODE_INSUFFICIENT_PRIVILEGE),
|
||||||
(errmsg("must be superuser to use raw page functions"))));
|
errmsg("must be superuser to use raw page functions")));
|
||||||
|
|
||||||
page = verify_brin_page(raw_page, BRIN_PAGETYPE_META, "metapage");
|
page = verify_brin_page(raw_page, BRIN_PAGETYPE_META, "metapage");
|
||||||
|
|
||||||
@ -374,7 +374,7 @@ brin_revmap_data(PG_FUNCTION_ARGS)
|
|||||||
if (!superuser())
|
if (!superuser())
|
||||||
ereport(ERROR,
|
ereport(ERROR,
|
||||||
(errcode(ERRCODE_INSUFFICIENT_PRIVILEGE),
|
(errcode(ERRCODE_INSUFFICIENT_PRIVILEGE),
|
||||||
(errmsg("must be superuser to use raw page functions"))));
|
errmsg("must be superuser to use raw page functions")));
|
||||||
|
|
||||||
if (SRF_IS_FIRSTCALL())
|
if (SRF_IS_FIRSTCALL())
|
||||||
{
|
{
|
||||||
|
@ -174,7 +174,7 @@ bt_page_stats(PG_FUNCTION_ARGS)
|
|||||||
if (!superuser())
|
if (!superuser())
|
||||||
ereport(ERROR,
|
ereport(ERROR,
|
||||||
(errcode(ERRCODE_INSUFFICIENT_PRIVILEGE),
|
(errcode(ERRCODE_INSUFFICIENT_PRIVILEGE),
|
||||||
(errmsg("must be superuser to use pageinspect functions"))));
|
errmsg("must be superuser to use pageinspect functions")));
|
||||||
|
|
||||||
relrv = makeRangeVarFromNameList(textToQualifiedNameList(relname));
|
relrv = makeRangeVarFromNameList(textToQualifiedNameList(relname));
|
||||||
rel = relation_openrv(relrv, AccessShareLock);
|
rel = relation_openrv(relrv, AccessShareLock);
|
||||||
@ -318,7 +318,7 @@ bt_page_items(PG_FUNCTION_ARGS)
|
|||||||
if (!superuser())
|
if (!superuser())
|
||||||
ereport(ERROR,
|
ereport(ERROR,
|
||||||
(errcode(ERRCODE_INSUFFICIENT_PRIVILEGE),
|
(errcode(ERRCODE_INSUFFICIENT_PRIVILEGE),
|
||||||
(errmsg("must be superuser to use pageinspect functions"))));
|
errmsg("must be superuser to use pageinspect functions")));
|
||||||
|
|
||||||
if (SRF_IS_FIRSTCALL())
|
if (SRF_IS_FIRSTCALL())
|
||||||
{
|
{
|
||||||
@ -428,7 +428,7 @@ bt_page_items_bytea(PG_FUNCTION_ARGS)
|
|||||||
if (!superuser())
|
if (!superuser())
|
||||||
ereport(ERROR,
|
ereport(ERROR,
|
||||||
(errcode(ERRCODE_INSUFFICIENT_PRIVILEGE),
|
(errcode(ERRCODE_INSUFFICIENT_PRIVILEGE),
|
||||||
(errmsg("must be superuser to use raw page functions"))));
|
errmsg("must be superuser to use raw page functions")));
|
||||||
|
|
||||||
if (SRF_IS_FIRSTCALL())
|
if (SRF_IS_FIRSTCALL())
|
||||||
{
|
{
|
||||||
@ -518,7 +518,7 @@ bt_metap(PG_FUNCTION_ARGS)
|
|||||||
if (!superuser())
|
if (!superuser())
|
||||||
ereport(ERROR,
|
ereport(ERROR,
|
||||||
(errcode(ERRCODE_INSUFFICIENT_PRIVILEGE),
|
(errcode(ERRCODE_INSUFFICIENT_PRIVILEGE),
|
||||||
(errmsg("must be superuser to use pageinspect functions"))));
|
errmsg("must be superuser to use pageinspect functions")));
|
||||||
|
|
||||||
relrv = makeRangeVarFromNameList(textToQualifiedNameList(relname));
|
relrv = makeRangeVarFromNameList(textToQualifiedNameList(relname));
|
||||||
rel = relation_openrv(relrv, AccessShareLock);
|
rel = relation_openrv(relrv, AccessShareLock);
|
||||||
|
@ -42,7 +42,7 @@ fsm_page_contents(PG_FUNCTION_ARGS)
|
|||||||
if (!superuser())
|
if (!superuser())
|
||||||
ereport(ERROR,
|
ereport(ERROR,
|
||||||
(errcode(ERRCODE_INSUFFICIENT_PRIVILEGE),
|
(errcode(ERRCODE_INSUFFICIENT_PRIVILEGE),
|
||||||
(errmsg("must be superuser to use raw page functions"))));
|
errmsg("must be superuser to use raw page functions")));
|
||||||
|
|
||||||
fsmpage = (FSMPage) PageGetContents(VARDATA(raw_page));
|
fsmpage = (FSMPage) PageGetContents(VARDATA(raw_page));
|
||||||
|
|
||||||
|
@ -45,7 +45,7 @@ gin_metapage_info(PG_FUNCTION_ARGS)
|
|||||||
if (!superuser())
|
if (!superuser())
|
||||||
ereport(ERROR,
|
ereport(ERROR,
|
||||||
(errcode(ERRCODE_INSUFFICIENT_PRIVILEGE),
|
(errcode(ERRCODE_INSUFFICIENT_PRIVILEGE),
|
||||||
(errmsg("must be superuser to use raw page functions"))));
|
errmsg("must be superuser to use raw page functions")));
|
||||||
|
|
||||||
page = get_page_from_raw(raw_page);
|
page = get_page_from_raw(raw_page);
|
||||||
|
|
||||||
@ -103,7 +103,7 @@ gin_page_opaque_info(PG_FUNCTION_ARGS)
|
|||||||
if (!superuser())
|
if (!superuser())
|
||||||
ereport(ERROR,
|
ereport(ERROR,
|
||||||
(errcode(ERRCODE_INSUFFICIENT_PRIVILEGE),
|
(errcode(ERRCODE_INSUFFICIENT_PRIVILEGE),
|
||||||
(errmsg("must be superuser to use raw page functions"))));
|
errmsg("must be superuser to use raw page functions")));
|
||||||
|
|
||||||
page = get_page_from_raw(raw_page);
|
page = get_page_from_raw(raw_page);
|
||||||
|
|
||||||
@ -169,7 +169,7 @@ gin_leafpage_items(PG_FUNCTION_ARGS)
|
|||||||
if (!superuser())
|
if (!superuser())
|
||||||
ereport(ERROR,
|
ereport(ERROR,
|
||||||
(errcode(ERRCODE_INSUFFICIENT_PRIVILEGE),
|
(errcode(ERRCODE_INSUFFICIENT_PRIVILEGE),
|
||||||
(errmsg("must be superuser to use raw page functions"))));
|
errmsg("must be superuser to use raw page functions")));
|
||||||
|
|
||||||
if (SRF_IS_FIRSTCALL())
|
if (SRF_IS_FIRSTCALL())
|
||||||
{
|
{
|
||||||
|
@ -195,7 +195,7 @@ hash_page_type(PG_FUNCTION_ARGS)
|
|||||||
if (!superuser())
|
if (!superuser())
|
||||||
ereport(ERROR,
|
ereport(ERROR,
|
||||||
(errcode(ERRCODE_INSUFFICIENT_PRIVILEGE),
|
(errcode(ERRCODE_INSUFFICIENT_PRIVILEGE),
|
||||||
(errmsg("must be superuser to use raw page functions"))));
|
errmsg("must be superuser to use raw page functions")));
|
||||||
|
|
||||||
page = verify_hash_page(raw_page, 0);
|
page = verify_hash_page(raw_page, 0);
|
||||||
|
|
||||||
@ -243,7 +243,7 @@ hash_page_stats(PG_FUNCTION_ARGS)
|
|||||||
if (!superuser())
|
if (!superuser())
|
||||||
ereport(ERROR,
|
ereport(ERROR,
|
||||||
(errcode(ERRCODE_INSUFFICIENT_PRIVILEGE),
|
(errcode(ERRCODE_INSUFFICIENT_PRIVILEGE),
|
||||||
(errmsg("must be superuser to use raw page functions"))));
|
errmsg("must be superuser to use raw page functions")));
|
||||||
|
|
||||||
page = verify_hash_page(raw_page, LH_BUCKET_PAGE | LH_OVERFLOW_PAGE);
|
page = verify_hash_page(raw_page, LH_BUCKET_PAGE | LH_OVERFLOW_PAGE);
|
||||||
|
|
||||||
@ -310,7 +310,7 @@ hash_page_items(PG_FUNCTION_ARGS)
|
|||||||
if (!superuser())
|
if (!superuser())
|
||||||
ereport(ERROR,
|
ereport(ERROR,
|
||||||
(errcode(ERRCODE_INSUFFICIENT_PRIVILEGE),
|
(errcode(ERRCODE_INSUFFICIENT_PRIVILEGE),
|
||||||
(errmsg("must be superuser to use raw page functions"))));
|
errmsg("must be superuser to use raw page functions")));
|
||||||
|
|
||||||
if (SRF_IS_FIRSTCALL())
|
if (SRF_IS_FIRSTCALL())
|
||||||
{
|
{
|
||||||
@ -415,7 +415,7 @@ hash_bitmap_info(PG_FUNCTION_ARGS)
|
|||||||
if (!superuser())
|
if (!superuser())
|
||||||
ereport(ERROR,
|
ereport(ERROR,
|
||||||
(errcode(ERRCODE_INSUFFICIENT_PRIVILEGE),
|
(errcode(ERRCODE_INSUFFICIENT_PRIVILEGE),
|
||||||
(errmsg("must be superuser to use raw page functions"))));
|
errmsg("must be superuser to use raw page functions")));
|
||||||
|
|
||||||
indexRel = index_open(indexRelid, AccessShareLock);
|
indexRel = index_open(indexRelid, AccessShareLock);
|
||||||
|
|
||||||
@ -526,7 +526,7 @@ hash_metapage_info(PG_FUNCTION_ARGS)
|
|||||||
if (!superuser())
|
if (!superuser())
|
||||||
ereport(ERROR,
|
ereport(ERROR,
|
||||||
(errcode(ERRCODE_INSUFFICIENT_PRIVILEGE),
|
(errcode(ERRCODE_INSUFFICIENT_PRIVILEGE),
|
||||||
(errmsg("must be superuser to use raw page functions"))));
|
errmsg("must be superuser to use raw page functions")));
|
||||||
|
|
||||||
page = verify_hash_page(raw_page, LH_META_PAGE);
|
page = verify_hash_page(raw_page, LH_META_PAGE);
|
||||||
|
|
||||||
|
@ -135,7 +135,7 @@ heap_page_items(PG_FUNCTION_ARGS)
|
|||||||
if (!superuser())
|
if (!superuser())
|
||||||
ereport(ERROR,
|
ereport(ERROR,
|
||||||
(errcode(ERRCODE_INSUFFICIENT_PRIVILEGE),
|
(errcode(ERRCODE_INSUFFICIENT_PRIVILEGE),
|
||||||
(errmsg("must be superuser to use raw page functions"))));
|
errmsg("must be superuser to use raw page functions")));
|
||||||
|
|
||||||
raw_page_size = VARSIZE(raw_page) - VARHDRSZ;
|
raw_page_size = VARSIZE(raw_page) - VARHDRSZ;
|
||||||
|
|
||||||
|
@ -102,7 +102,7 @@ get_raw_page_internal(text *relname, ForkNumber forknum, BlockNumber blkno)
|
|||||||
if (!superuser())
|
if (!superuser())
|
||||||
ereport(ERROR,
|
ereport(ERROR,
|
||||||
(errcode(ERRCODE_INSUFFICIENT_PRIVILEGE),
|
(errcode(ERRCODE_INSUFFICIENT_PRIVILEGE),
|
||||||
(errmsg("must be superuser to use raw page functions"))));
|
errmsg("must be superuser to use raw page functions")));
|
||||||
|
|
||||||
relrv = makeRangeVarFromNameList(textToQualifiedNameList(relname));
|
relrv = makeRangeVarFromNameList(textToQualifiedNameList(relname));
|
||||||
rel = relation_openrv(relrv, AccessShareLock);
|
rel = relation_openrv(relrv, AccessShareLock);
|
||||||
@ -233,7 +233,7 @@ page_header(PG_FUNCTION_ARGS)
|
|||||||
if (!superuser())
|
if (!superuser())
|
||||||
ereport(ERROR,
|
ereport(ERROR,
|
||||||
(errcode(ERRCODE_INSUFFICIENT_PRIVILEGE),
|
(errcode(ERRCODE_INSUFFICIENT_PRIVILEGE),
|
||||||
(errmsg("must be superuser to use raw page functions"))));
|
errmsg("must be superuser to use raw page functions")));
|
||||||
|
|
||||||
raw_page_size = VARSIZE(raw_page) - VARHDRSZ;
|
raw_page_size = VARSIZE(raw_page) - VARHDRSZ;
|
||||||
|
|
||||||
@ -305,7 +305,7 @@ page_checksum(PG_FUNCTION_ARGS)
|
|||||||
if (!superuser())
|
if (!superuser())
|
||||||
ereport(ERROR,
|
ereport(ERROR,
|
||||||
(errcode(ERRCODE_INSUFFICIENT_PRIVILEGE),
|
(errcode(ERRCODE_INSUFFICIENT_PRIVILEGE),
|
||||||
(errmsg("must be superuser to use raw page functions"))));
|
errmsg("must be superuser to use raw page functions")));
|
||||||
|
|
||||||
raw_page_size = VARSIZE(raw_page) - VARHDRSZ;
|
raw_page_size = VARSIZE(raw_page) - VARHDRSZ;
|
||||||
|
|
||||||
|
@ -77,7 +77,7 @@ pg_prewarm(PG_FUNCTION_ARGS)
|
|||||||
if (PG_ARGISNULL(1))
|
if (PG_ARGISNULL(1))
|
||||||
ereport(ERROR,
|
ereport(ERROR,
|
||||||
(errcode(ERRCODE_INVALID_PARAMETER_VALUE),
|
(errcode(ERRCODE_INVALID_PARAMETER_VALUE),
|
||||||
(errmsg("prewarm type cannot be null"))));
|
errmsg("prewarm type cannot be null")));
|
||||||
type = PG_GETARG_TEXT_PP(1);
|
type = PG_GETARG_TEXT_PP(1);
|
||||||
ttype = text_to_cstring(type);
|
ttype = text_to_cstring(type);
|
||||||
if (strcmp(ttype, "prefetch") == 0)
|
if (strcmp(ttype, "prefetch") == 0)
|
||||||
@ -97,7 +97,7 @@ pg_prewarm(PG_FUNCTION_ARGS)
|
|||||||
if (PG_ARGISNULL(2))
|
if (PG_ARGISNULL(2))
|
||||||
ereport(ERROR,
|
ereport(ERROR,
|
||||||
(errcode(ERRCODE_INVALID_PARAMETER_VALUE),
|
(errcode(ERRCODE_INVALID_PARAMETER_VALUE),
|
||||||
(errmsg("relation fork cannot be null"))));
|
errmsg("relation fork cannot be null")));
|
||||||
forkName = PG_GETARG_TEXT_PP(2);
|
forkName = PG_GETARG_TEXT_PP(2);
|
||||||
forkString = text_to_cstring(forkName);
|
forkString = text_to_cstring(forkName);
|
||||||
forkNumber = forkname_to_number(forkString);
|
forkNumber = forkname_to_number(forkString);
|
||||||
|
@ -228,7 +228,7 @@ pgstattuple_approx(PG_FUNCTION_ARGS)
|
|||||||
if (!superuser())
|
if (!superuser())
|
||||||
ereport(ERROR,
|
ereport(ERROR,
|
||||||
(errcode(ERRCODE_INSUFFICIENT_PRIVILEGE),
|
(errcode(ERRCODE_INSUFFICIENT_PRIVILEGE),
|
||||||
(errmsg("must be superuser to use pgstattuple functions"))));
|
errmsg("must be superuser to use pgstattuple functions")));
|
||||||
|
|
||||||
PG_RETURN_DATUM(pgstattuple_approx_internal(relid, fcinfo));
|
PG_RETURN_DATUM(pgstattuple_approx_internal(relid, fcinfo));
|
||||||
}
|
}
|
||||||
|
@ -151,7 +151,7 @@ pgstatindex(PG_FUNCTION_ARGS)
|
|||||||
if (!superuser())
|
if (!superuser())
|
||||||
ereport(ERROR,
|
ereport(ERROR,
|
||||||
(errcode(ERRCODE_INSUFFICIENT_PRIVILEGE),
|
(errcode(ERRCODE_INSUFFICIENT_PRIVILEGE),
|
||||||
(errmsg("must be superuser to use pgstattuple functions"))));
|
errmsg("must be superuser to use pgstattuple functions")));
|
||||||
|
|
||||||
relrv = makeRangeVarFromNameList(textToQualifiedNameList(relname));
|
relrv = makeRangeVarFromNameList(textToQualifiedNameList(relname));
|
||||||
rel = relation_openrv(relrv, AccessShareLock);
|
rel = relation_openrv(relrv, AccessShareLock);
|
||||||
@ -193,7 +193,7 @@ pgstatindexbyid(PG_FUNCTION_ARGS)
|
|||||||
if (!superuser())
|
if (!superuser())
|
||||||
ereport(ERROR,
|
ereport(ERROR,
|
||||||
(errcode(ERRCODE_INSUFFICIENT_PRIVILEGE),
|
(errcode(ERRCODE_INSUFFICIENT_PRIVILEGE),
|
||||||
(errmsg("must be superuser to use pgstattuple functions"))));
|
errmsg("must be superuser to use pgstattuple functions")));
|
||||||
|
|
||||||
rel = relation_open(relid, AccessShareLock);
|
rel = relation_open(relid, AccessShareLock);
|
||||||
|
|
||||||
@ -386,7 +386,7 @@ pg_relpages(PG_FUNCTION_ARGS)
|
|||||||
if (!superuser())
|
if (!superuser())
|
||||||
ereport(ERROR,
|
ereport(ERROR,
|
||||||
(errcode(ERRCODE_INSUFFICIENT_PRIVILEGE),
|
(errcode(ERRCODE_INSUFFICIENT_PRIVILEGE),
|
||||||
(errmsg("must be superuser to use pgstattuple functions"))));
|
errmsg("must be superuser to use pgstattuple functions")));
|
||||||
|
|
||||||
relrv = makeRangeVarFromNameList(textToQualifiedNameList(relname));
|
relrv = makeRangeVarFromNameList(textToQualifiedNameList(relname));
|
||||||
rel = relation_openrv(relrv, AccessShareLock);
|
rel = relation_openrv(relrv, AccessShareLock);
|
||||||
@ -438,7 +438,7 @@ pg_relpagesbyid(PG_FUNCTION_ARGS)
|
|||||||
if (!superuser())
|
if (!superuser())
|
||||||
ereport(ERROR,
|
ereport(ERROR,
|
||||||
(errcode(ERRCODE_INSUFFICIENT_PRIVILEGE),
|
(errcode(ERRCODE_INSUFFICIENT_PRIVILEGE),
|
||||||
(errmsg("must be superuser to use pgstattuple functions"))));
|
errmsg("must be superuser to use pgstattuple functions")));
|
||||||
|
|
||||||
rel = relation_open(relid, AccessShareLock);
|
rel = relation_open(relid, AccessShareLock);
|
||||||
|
|
||||||
@ -492,7 +492,7 @@ pgstatginindex(PG_FUNCTION_ARGS)
|
|||||||
if (!superuser())
|
if (!superuser())
|
||||||
ereport(ERROR,
|
ereport(ERROR,
|
||||||
(errcode(ERRCODE_INSUFFICIENT_PRIVILEGE),
|
(errcode(ERRCODE_INSUFFICIENT_PRIVILEGE),
|
||||||
(errmsg("must be superuser to use pgstattuple functions"))));
|
errmsg("must be superuser to use pgstattuple functions")));
|
||||||
|
|
||||||
PG_RETURN_DATUM(pgstatginindex_internal(relid, fcinfo));
|
PG_RETURN_DATUM(pgstatginindex_internal(relid, fcinfo));
|
||||||
}
|
}
|
||||||
|
@ -173,7 +173,7 @@ pgstattuple(PG_FUNCTION_ARGS)
|
|||||||
if (!superuser())
|
if (!superuser())
|
||||||
ereport(ERROR,
|
ereport(ERROR,
|
||||||
(errcode(ERRCODE_INSUFFICIENT_PRIVILEGE),
|
(errcode(ERRCODE_INSUFFICIENT_PRIVILEGE),
|
||||||
(errmsg("must be superuser to use pgstattuple functions"))));
|
errmsg("must be superuser to use pgstattuple functions")));
|
||||||
|
|
||||||
/* open relation */
|
/* open relation */
|
||||||
relrv = makeRangeVarFromNameList(textToQualifiedNameList(relname));
|
relrv = makeRangeVarFromNameList(textToQualifiedNameList(relname));
|
||||||
@ -213,7 +213,7 @@ pgstattuplebyid(PG_FUNCTION_ARGS)
|
|||||||
if (!superuser())
|
if (!superuser())
|
||||||
ereport(ERROR,
|
ereport(ERROR,
|
||||||
(errcode(ERRCODE_INSUFFICIENT_PRIVILEGE),
|
(errcode(ERRCODE_INSUFFICIENT_PRIVILEGE),
|
||||||
(errmsg("must be superuser to use pgstattuple functions"))));
|
errmsg("must be superuser to use pgstattuple functions")));
|
||||||
|
|
||||||
/* open relation */
|
/* open relation */
|
||||||
rel = relation_open(relid, AccessShareLock);
|
rel = relation_open(relid, AccessShareLock);
|
||||||
|
@ -298,8 +298,8 @@ pg_create_restore_point(PG_FUNCTION_ARGS)
|
|||||||
if (RecoveryInProgress())
|
if (RecoveryInProgress())
|
||||||
ereport(ERROR,
|
ereport(ERROR,
|
||||||
(errcode(ERRCODE_OBJECT_NOT_IN_PREREQUISITE_STATE),
|
(errcode(ERRCODE_OBJECT_NOT_IN_PREREQUISITE_STATE),
|
||||||
(errmsg("recovery is in progress"),
|
errmsg("recovery is in progress"),
|
||||||
errhint("WAL control functions cannot be executed during recovery."))));
|
errhint("WAL control functions cannot be executed during recovery.")));
|
||||||
|
|
||||||
if (!XLogIsNeeded())
|
if (!XLogIsNeeded())
|
||||||
ereport(ERROR,
|
ereport(ERROR,
|
||||||
|
@ -212,8 +212,8 @@ AlterObjectRename_internal(Relation rel, Oid objectId, const char *new_name)
|
|||||||
if (Anum_owner <= 0)
|
if (Anum_owner <= 0)
|
||||||
ereport(ERROR,
|
ereport(ERROR,
|
||||||
(errcode(ERRCODE_INSUFFICIENT_PRIVILEGE),
|
(errcode(ERRCODE_INSUFFICIENT_PRIVILEGE),
|
||||||
(errmsg("must be superuser to rename %s",
|
errmsg("must be superuser to rename %s",
|
||||||
getObjectDescriptionOids(classId, objectId)))));
|
getObjectDescriptionOids(classId, objectId))));
|
||||||
|
|
||||||
/* Otherwise, must be owner of the existing object */
|
/* Otherwise, must be owner of the existing object */
|
||||||
datum = heap_getattr(oldtup, Anum_owner,
|
datum = heap_getattr(oldtup, Anum_owner,
|
||||||
@ -715,8 +715,8 @@ AlterObjectNamespace_internal(Relation rel, Oid objid, Oid nspOid)
|
|||||||
if (Anum_owner <= 0)
|
if (Anum_owner <= 0)
|
||||||
ereport(ERROR,
|
ereport(ERROR,
|
||||||
(errcode(ERRCODE_INSUFFICIENT_PRIVILEGE),
|
(errcode(ERRCODE_INSUFFICIENT_PRIVILEGE),
|
||||||
(errmsg("must be superuser to set schema of %s",
|
errmsg("must be superuser to set schema of %s",
|
||||||
getObjectDescriptionOids(classId, objid)))));
|
getObjectDescriptionOids(classId, objid))));
|
||||||
|
|
||||||
/* Otherwise, must be owner of the existing object */
|
/* Otherwise, must be owner of the existing object */
|
||||||
owner = heap_getattr(tup, Anum_owner, RelationGetDescr(rel), &isnull);
|
owner = heap_getattr(tup, Anum_owner, RelationGetDescr(rel), &isnull);
|
||||||
|
@ -527,7 +527,7 @@ pg_import_system_collations(PG_FUNCTION_ARGS)
|
|||||||
if (!superuser())
|
if (!superuser())
|
||||||
ereport(ERROR,
|
ereport(ERROR,
|
||||||
(errcode(ERRCODE_INSUFFICIENT_PRIVILEGE),
|
(errcode(ERRCODE_INSUFFICIENT_PRIVILEGE),
|
||||||
(errmsg("must be superuser to import system collations"))));
|
errmsg("must be superuser to import system collations")));
|
||||||
|
|
||||||
/* Load collations known to libc, using "locale -a" to enumerate them */
|
/* Load collations known to libc, using "locale -a" to enumerate them */
|
||||||
#ifdef READ_LOCALE_A_OUTPUT
|
#ifdef READ_LOCALE_A_OUTPUT
|
||||||
|
@ -537,7 +537,7 @@ intorel_startup(DestReceiver *self, int operation, TupleDesc typeinfo)
|
|||||||
if (check_enable_rls(intoRelationAddr.objectId, InvalidOid, false) == RLS_ENABLED)
|
if (check_enable_rls(intoRelationAddr.objectId, InvalidOid, false) == RLS_ENABLED)
|
||||||
ereport(ERROR,
|
ereport(ERROR,
|
||||||
(errcode(ERRCODE_FEATURE_NOT_SUPPORTED),
|
(errcode(ERRCODE_FEATURE_NOT_SUPPORTED),
|
||||||
(errmsg("policies not yet implemented for this command"))));
|
errmsg("policies not yet implemented for this command")));
|
||||||
|
|
||||||
/*
|
/*
|
||||||
* Tentatively mark the target as populated, if it's a matview and we're
|
* Tentatively mark the target as populated, if it's a matview and we're
|
||||||
|
@ -286,8 +286,8 @@ interpret_function_parameter_list(ParseState *pstate,
|
|||||||
if (fp->mode == FUNC_PARAM_OUT)
|
if (fp->mode == FUNC_PARAM_OUT)
|
||||||
ereport(ERROR,
|
ereport(ERROR,
|
||||||
(errcode(ERRCODE_FEATURE_NOT_SUPPORTED),
|
(errcode(ERRCODE_FEATURE_NOT_SUPPORTED),
|
||||||
(errmsg("procedures cannot have OUT arguments"),
|
errmsg("procedures cannot have OUT arguments"),
|
||||||
errhint("INOUT arguments are permitted."))));
|
errhint("INOUT arguments are permitted.")));
|
||||||
}
|
}
|
||||||
|
|
||||||
/* handle input parameters */
|
/* handle input parameters */
|
||||||
|
@ -158,7 +158,7 @@ CreatePublication(CreatePublicationStmt *stmt)
|
|||||||
if (stmt->for_all_tables && !superuser())
|
if (stmt->for_all_tables && !superuser())
|
||||||
ereport(ERROR,
|
ereport(ERROR,
|
||||||
(errcode(ERRCODE_INSUFFICIENT_PRIVILEGE),
|
(errcode(ERRCODE_INSUFFICIENT_PRIVILEGE),
|
||||||
(errmsg("must be superuser to create FOR ALL TABLES publication"))));
|
errmsg("must be superuser to create FOR ALL TABLES publication")));
|
||||||
|
|
||||||
rel = table_open(PublicationRelationId, RowExclusiveLock);
|
rel = table_open(PublicationRelationId, RowExclusiveLock);
|
||||||
|
|
||||||
|
@ -347,7 +347,7 @@ CreateSubscription(CreateSubscriptionStmt *stmt, bool isTopLevel)
|
|||||||
if (!superuser())
|
if (!superuser())
|
||||||
ereport(ERROR,
|
ereport(ERROR,
|
||||||
(errcode(ERRCODE_INSUFFICIENT_PRIVILEGE),
|
(errcode(ERRCODE_INSUFFICIENT_PRIVILEGE),
|
||||||
(errmsg("must be superuser to create subscriptions"))));
|
errmsg("must be superuser to create subscriptions")));
|
||||||
|
|
||||||
/*
|
/*
|
||||||
* If built with appropriate switch, whine when regression-testing
|
* If built with appropriate switch, whine when regression-testing
|
||||||
|
@ -1523,8 +1523,8 @@ AddRoleMems(const char *rolename, Oid roleid,
|
|||||||
if (is_member_of_role_nosuper(roleid, memberid))
|
if (is_member_of_role_nosuper(roleid, memberid))
|
||||||
ereport(ERROR,
|
ereport(ERROR,
|
||||||
(errcode(ERRCODE_INVALID_GRANT_OPERATION),
|
(errcode(ERRCODE_INVALID_GRANT_OPERATION),
|
||||||
(errmsg("role \"%s\" is a member of role \"%s\"",
|
errmsg("role \"%s\" is a member of role \"%s\"",
|
||||||
rolename, get_rolespec_name(memberRole)))));
|
rolename, get_rolespec_name(memberRole))));
|
||||||
|
|
||||||
/*
|
/*
|
||||||
* Check if entry for this role/member already exists; if so, give
|
* Check if entry for this role/member already exists; if so, give
|
||||||
|
@ -997,8 +997,8 @@ read_client_first_message(scram_state *state, const char *input)
|
|||||||
if (strcmp(channel_binding_type, "tls-server-end-point") != 0)
|
if (strcmp(channel_binding_type, "tls-server-end-point") != 0)
|
||||||
ereport(ERROR,
|
ereport(ERROR,
|
||||||
(errcode(ERRCODE_PROTOCOL_VIOLATION),
|
(errcode(ERRCODE_PROTOCOL_VIOLATION),
|
||||||
(errmsg("unsupported SCRAM channel-binding type \"%s\"",
|
errmsg("unsupported SCRAM channel-binding type \"%s\"",
|
||||||
sanitize_str(channel_binding_type)))));
|
sanitize_str(channel_binding_type))));
|
||||||
break;
|
break;
|
||||||
default:
|
default:
|
||||||
ereport(ERROR,
|
ereport(ERROR,
|
||||||
@ -1282,7 +1282,7 @@ read_client_final_message(scram_state *state, const char *input)
|
|||||||
if (strcmp(channel_binding, b64_message) != 0)
|
if (strcmp(channel_binding, b64_message) != 0)
|
||||||
ereport(ERROR,
|
ereport(ERROR,
|
||||||
(errcode(ERRCODE_INVALID_AUTHORIZATION_SPECIFICATION),
|
(errcode(ERRCODE_INVALID_AUTHORIZATION_SPECIFICATION),
|
||||||
(errmsg("SCRAM channel binding check failed"))));
|
errmsg("SCRAM channel binding check failed")));
|
||||||
#else
|
#else
|
||||||
/* shouldn't happen, because we checked this earlier already */
|
/* shouldn't happen, because we checked this earlier already */
|
||||||
elog(ERROR, "channel binding not supported by this build");
|
elog(ERROR, "channel binding not supported by this build");
|
||||||
@ -1300,7 +1300,7 @@ read_client_final_message(scram_state *state, const char *input)
|
|||||||
!(strcmp(channel_binding, "eSws") == 0 && state->cbind_flag == 'y'))
|
!(strcmp(channel_binding, "eSws") == 0 && state->cbind_flag == 'y'))
|
||||||
ereport(ERROR,
|
ereport(ERROR,
|
||||||
(errcode(ERRCODE_PROTOCOL_VIOLATION),
|
(errcode(ERRCODE_PROTOCOL_VIOLATION),
|
||||||
(errmsg("unexpected SCRAM channel-binding attribute in client-final-message"))));
|
errmsg("unexpected SCRAM channel-binding attribute in client-final-message")));
|
||||||
}
|
}
|
||||||
|
|
||||||
state->client_final_nonce = read_attr_value(&p, 'r');
|
state->client_final_nonce = read_attr_value(&p, 'r');
|
||||||
|
@ -999,7 +999,7 @@ initialize_dh(SSL_CTX *context, bool isServerStart)
|
|||||||
{
|
{
|
||||||
ereport(isServerStart ? FATAL : LOG,
|
ereport(isServerStart ? FATAL : LOG,
|
||||||
(errcode(ERRCODE_CONFIG_FILE_ERROR),
|
(errcode(ERRCODE_CONFIG_FILE_ERROR),
|
||||||
(errmsg("DH: could not load DH parameters"))));
|
errmsg("DH: could not load DH parameters")));
|
||||||
return false;
|
return false;
|
||||||
}
|
}
|
||||||
|
|
||||||
@ -1007,8 +1007,8 @@ initialize_dh(SSL_CTX *context, bool isServerStart)
|
|||||||
{
|
{
|
||||||
ereport(isServerStart ? FATAL : LOG,
|
ereport(isServerStart ? FATAL : LOG,
|
||||||
(errcode(ERRCODE_CONFIG_FILE_ERROR),
|
(errcode(ERRCODE_CONFIG_FILE_ERROR),
|
||||||
(errmsg("DH: could not set DH parameters: %s",
|
errmsg("DH: could not set DH parameters: %s",
|
||||||
SSLerrmessage(ERR_get_error())))));
|
SSLerrmessage(ERR_get_error()))));
|
||||||
DH_free(dh);
|
DH_free(dh);
|
||||||
return false;
|
return false;
|
||||||
}
|
}
|
||||||
|
@ -569,7 +569,7 @@ SysLogger_Start(void)
|
|||||||
if (pipe(syslogPipe) < 0)
|
if (pipe(syslogPipe) < 0)
|
||||||
ereport(FATAL,
|
ereport(FATAL,
|
||||||
(errcode_for_socket_access(),
|
(errcode_for_socket_access(),
|
||||||
(errmsg("could not create pipe for syslog: %m"))));
|
errmsg("could not create pipe for syslog: %m")));
|
||||||
}
|
}
|
||||||
#else
|
#else
|
||||||
if (!syslogPipe[0])
|
if (!syslogPipe[0])
|
||||||
@ -583,7 +583,7 @@ SysLogger_Start(void)
|
|||||||
if (!CreatePipe(&syslogPipe[0], &syslogPipe[1], &sa, 32768))
|
if (!CreatePipe(&syslogPipe[0], &syslogPipe[1], &sa, 32768))
|
||||||
ereport(FATAL,
|
ereport(FATAL,
|
||||||
(errcode_for_file_access(),
|
(errcode_for_file_access(),
|
||||||
(errmsg("could not create pipe for syslog: %m"))));
|
errmsg("could not create pipe for syslog: %m")));
|
||||||
}
|
}
|
||||||
#endif
|
#endif
|
||||||
|
|
||||||
|
@ -390,13 +390,13 @@ CreateDecodingContext(XLogRecPtr start_lsn,
|
|||||||
if (SlotIsPhysical(slot))
|
if (SlotIsPhysical(slot))
|
||||||
ereport(ERROR,
|
ereport(ERROR,
|
||||||
(errcode(ERRCODE_OBJECT_NOT_IN_PREREQUISITE_STATE),
|
(errcode(ERRCODE_OBJECT_NOT_IN_PREREQUISITE_STATE),
|
||||||
(errmsg("cannot use physical replication slot for logical decoding"))));
|
errmsg("cannot use physical replication slot for logical decoding")));
|
||||||
|
|
||||||
if (slot->data.database != MyDatabaseId)
|
if (slot->data.database != MyDatabaseId)
|
||||||
ereport(ERROR,
|
ereport(ERROR,
|
||||||
(errcode(ERRCODE_OBJECT_NOT_IN_PREREQUISITE_STATE),
|
(errcode(ERRCODE_OBJECT_NOT_IN_PREREQUISITE_STATE),
|
||||||
(errmsg("replication slot \"%s\" was not created in this database",
|
errmsg("replication slot \"%s\" was not created in this database",
|
||||||
NameStr(slot->data.name)))));
|
NameStr(slot->data.name))));
|
||||||
|
|
||||||
if (start_lsn == InvalidXLogRecPtr)
|
if (start_lsn == InvalidXLogRecPtr)
|
||||||
{
|
{
|
||||||
|
@ -103,7 +103,7 @@ check_permissions(void)
|
|||||||
if (!superuser() && !has_rolreplication(GetUserId()))
|
if (!superuser() && !has_rolreplication(GetUserId()))
|
||||||
ereport(ERROR,
|
ereport(ERROR,
|
||||||
(errcode(ERRCODE_INSUFFICIENT_PRIVILEGE),
|
(errcode(ERRCODE_INSUFFICIENT_PRIVILEGE),
|
||||||
(errmsg("must be superuser or replication role to use replication slots"))));
|
errmsg("must be superuser or replication role to use replication slots")));
|
||||||
}
|
}
|
||||||
|
|
||||||
int
|
int
|
||||||
|
@ -333,7 +333,7 @@ timeline_history:
|
|||||||
if ($2 <= 0)
|
if ($2 <= 0)
|
||||||
ereport(ERROR,
|
ereport(ERROR,
|
||||||
(errcode(ERRCODE_SYNTAX_ERROR),
|
(errcode(ERRCODE_SYNTAX_ERROR),
|
||||||
(errmsg("invalid timeline %u", $2))));
|
errmsg("invalid timeline %u", $2)));
|
||||||
|
|
||||||
cmd = makeNode(TimeLineHistoryCmd);
|
cmd = makeNode(TimeLineHistoryCmd);
|
||||||
cmd->timeline = $2;
|
cmd->timeline = $2;
|
||||||
@ -365,7 +365,7 @@ opt_timeline:
|
|||||||
if ($2 <= 0)
|
if ($2 <= 0)
|
||||||
ereport(ERROR,
|
ereport(ERROR,
|
||||||
(errcode(ERRCODE_SYNTAX_ERROR),
|
(errcode(ERRCODE_SYNTAX_ERROR),
|
||||||
(errmsg("invalid timeline %u", $2))));
|
errmsg("invalid timeline %u", $2)));
|
||||||
$$ = $2;
|
$$ = $2;
|
||||||
}
|
}
|
||||||
| /* EMPTY */ { $$ = 0; }
|
| /* EMPTY */ { $$ = 0; }
|
||||||
|
@ -979,7 +979,7 @@ CheckSlotRequirements(void)
|
|||||||
if (max_replication_slots == 0)
|
if (max_replication_slots == 0)
|
||||||
ereport(ERROR,
|
ereport(ERROR,
|
||||||
(errcode(ERRCODE_OBJECT_NOT_IN_PREREQUISITE_STATE),
|
(errcode(ERRCODE_OBJECT_NOT_IN_PREREQUISITE_STATE),
|
||||||
(errmsg("replication slots can only be used if max_replication_slots > 0"))));
|
errmsg("replication slots can only be used if max_replication_slots > 0")));
|
||||||
|
|
||||||
if (wal_level < WAL_LEVEL_REPLICA)
|
if (wal_level < WAL_LEVEL_REPLICA)
|
||||||
ereport(ERROR,
|
ereport(ERROR,
|
||||||
|
@ -31,7 +31,7 @@ check_permissions(void)
|
|||||||
if (!superuser() && !has_rolreplication(GetUserId()))
|
if (!superuser() && !has_rolreplication(GetUserId()))
|
||||||
ereport(ERROR,
|
ereport(ERROR,
|
||||||
(errcode(ERRCODE_INSUFFICIENT_PRIVILEGE),
|
(errcode(ERRCODE_INSUFFICIENT_PRIVILEGE),
|
||||||
(errmsg("must be superuser or replication role to use replication slots"))));
|
errmsg("must be superuser or replication role to use replication slots")));
|
||||||
}
|
}
|
||||||
|
|
||||||
/*
|
/*
|
||||||
@ -669,7 +669,7 @@ copy_replication_slot(FunctionCallInfo fcinfo, bool logical_slot)
|
|||||||
Assert(!logical_slot);
|
Assert(!logical_slot);
|
||||||
ereport(ERROR,
|
ereport(ERROR,
|
||||||
(errcode(ERRCODE_FEATURE_NOT_SUPPORTED),
|
(errcode(ERRCODE_FEATURE_NOT_SUPPORTED),
|
||||||
(errmsg("cannot copy a replication slot that doesn't reserve WAL"))));
|
errmsg("cannot copy a replication slot that doesn't reserve WAL")));
|
||||||
}
|
}
|
||||||
|
|
||||||
/* Overwrite params from optional arguments */
|
/* Overwrite params from optional arguments */
|
||||||
|
@ -563,7 +563,7 @@ StartReplication(StartReplicationCmd *cmd)
|
|||||||
if (SlotIsLogical(MyReplicationSlot))
|
if (SlotIsLogical(MyReplicationSlot))
|
||||||
ereport(ERROR,
|
ereport(ERROR,
|
||||||
(errcode(ERRCODE_OBJECT_NOT_IN_PREREQUISITE_STATE),
|
(errcode(ERRCODE_OBJECT_NOT_IN_PREREQUISITE_STATE),
|
||||||
(errmsg("cannot use a logical replication slot for physical replication"))));
|
errmsg("cannot use a logical replication slot for physical replication")));
|
||||||
}
|
}
|
||||||
|
|
||||||
/*
|
/*
|
||||||
@ -1499,8 +1499,8 @@ exec_replication_command(const char *cmd_string)
|
|||||||
if (parse_rc != 0)
|
if (parse_rc != 0)
|
||||||
ereport(ERROR,
|
ereport(ERROR,
|
||||||
(errcode(ERRCODE_SYNTAX_ERROR),
|
(errcode(ERRCODE_SYNTAX_ERROR),
|
||||||
(errmsg_internal("replication command parser returned %d",
|
errmsg_internal("replication command parser returned %d",
|
||||||
parse_rc))));
|
parse_rc)));
|
||||||
|
|
||||||
cmd_node = replication_parse_result;
|
cmd_node = replication_parse_result;
|
||||||
|
|
||||||
|
@ -3046,14 +3046,14 @@ TerminateOtherDBBackends(Oid databaseId)
|
|||||||
if (superuser_arg(proc->roleId) && !superuser())
|
if (superuser_arg(proc->roleId) && !superuser())
|
||||||
ereport(ERROR,
|
ereport(ERROR,
|
||||||
(errcode(ERRCODE_INSUFFICIENT_PRIVILEGE),
|
(errcode(ERRCODE_INSUFFICIENT_PRIVILEGE),
|
||||||
(errmsg("must be a superuser to terminate superuser process"))));
|
errmsg("must be a superuser to terminate superuser process")));
|
||||||
|
|
||||||
/* Users can signal backends they have role membership in. */
|
/* Users can signal backends they have role membership in. */
|
||||||
if (!has_privs_of_role(GetUserId(), proc->roleId) &&
|
if (!has_privs_of_role(GetUserId(), proc->roleId) &&
|
||||||
!has_privs_of_role(GetUserId(), DEFAULT_ROLE_SIGNAL_BACKENDID))
|
!has_privs_of_role(GetUserId(), DEFAULT_ROLE_SIGNAL_BACKENDID))
|
||||||
ereport(ERROR,
|
ereport(ERROR,
|
||||||
(errcode(ERRCODE_INSUFFICIENT_PRIVILEGE),
|
(errcode(ERRCODE_INSUFFICIENT_PRIVILEGE),
|
||||||
(errmsg("must be a member of the role whose process is being terminated or member of pg_signal_backend"))));
|
errmsg("must be a member of the role whose process is being terminated or member of pg_signal_backend")));
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
|
@ -115,12 +115,12 @@ pg_cancel_backend(PG_FUNCTION_ARGS)
|
|||||||
if (r == SIGNAL_BACKEND_NOSUPERUSER)
|
if (r == SIGNAL_BACKEND_NOSUPERUSER)
|
||||||
ereport(ERROR,
|
ereport(ERROR,
|
||||||
(errcode(ERRCODE_INSUFFICIENT_PRIVILEGE),
|
(errcode(ERRCODE_INSUFFICIENT_PRIVILEGE),
|
||||||
(errmsg("must be a superuser to cancel superuser query"))));
|
errmsg("must be a superuser to cancel superuser query")));
|
||||||
|
|
||||||
if (r == SIGNAL_BACKEND_NOPERMISSION)
|
if (r == SIGNAL_BACKEND_NOPERMISSION)
|
||||||
ereport(ERROR,
|
ereport(ERROR,
|
||||||
(errcode(ERRCODE_INSUFFICIENT_PRIVILEGE),
|
(errcode(ERRCODE_INSUFFICIENT_PRIVILEGE),
|
||||||
(errmsg("must be a member of the role whose query is being canceled or member of pg_signal_backend"))));
|
errmsg("must be a member of the role whose query is being canceled or member of pg_signal_backend")));
|
||||||
|
|
||||||
PG_RETURN_BOOL(r == SIGNAL_BACKEND_SUCCESS);
|
PG_RETURN_BOOL(r == SIGNAL_BACKEND_SUCCESS);
|
||||||
}
|
}
|
||||||
@ -139,12 +139,12 @@ pg_terminate_backend(PG_FUNCTION_ARGS)
|
|||||||
if (r == SIGNAL_BACKEND_NOSUPERUSER)
|
if (r == SIGNAL_BACKEND_NOSUPERUSER)
|
||||||
ereport(ERROR,
|
ereport(ERROR,
|
||||||
(errcode(ERRCODE_INSUFFICIENT_PRIVILEGE),
|
(errcode(ERRCODE_INSUFFICIENT_PRIVILEGE),
|
||||||
(errmsg("must be a superuser to terminate superuser process"))));
|
errmsg("must be a superuser to terminate superuser process")));
|
||||||
|
|
||||||
if (r == SIGNAL_BACKEND_NOPERMISSION)
|
if (r == SIGNAL_BACKEND_NOPERMISSION)
|
||||||
ereport(ERROR,
|
ereport(ERROR,
|
||||||
(errcode(ERRCODE_INSUFFICIENT_PRIVILEGE),
|
(errcode(ERRCODE_INSUFFICIENT_PRIVILEGE),
|
||||||
(errmsg("must be a member of the role whose process is being terminated or member of pg_signal_backend"))));
|
errmsg("must be a member of the role whose process is being terminated or member of pg_signal_backend")));
|
||||||
|
|
||||||
PG_RETURN_BOOL(r == SIGNAL_BACKEND_SUCCESS);
|
PG_RETURN_BOOL(r == SIGNAL_BACKEND_SUCCESS);
|
||||||
}
|
}
|
||||||
@ -180,10 +180,10 @@ pg_rotate_logfile(PG_FUNCTION_ARGS)
|
|||||||
if (!superuser())
|
if (!superuser())
|
||||||
ereport(ERROR,
|
ereport(ERROR,
|
||||||
(errcode(ERRCODE_INSUFFICIENT_PRIVILEGE),
|
(errcode(ERRCODE_INSUFFICIENT_PRIVILEGE),
|
||||||
(errmsg("must be superuser to rotate log files with adminpack 1.0"),
|
errmsg("must be superuser to rotate log files with adminpack 1.0"),
|
||||||
/* translator: %s is a SQL function name */
|
/* translator: %s is a SQL function name */
|
||||||
errhint("Consider using %s, which is part of core, instead.",
|
errhint("Consider using %s, which is part of core, instead.",
|
||||||
"pg_logfile_rotate()"))));
|
"pg_logfile_rotate()")));
|
||||||
|
|
||||||
if (!Logging_collector)
|
if (!Logging_collector)
|
||||||
{
|
{
|
||||||
|
@ -78,7 +78,7 @@ convert_and_check_filename(text *arg)
|
|||||||
if (path_contains_parent_reference(filename))
|
if (path_contains_parent_reference(filename))
|
||||||
ereport(ERROR,
|
ereport(ERROR,
|
||||||
(errcode(ERRCODE_INSUFFICIENT_PRIVILEGE),
|
(errcode(ERRCODE_INSUFFICIENT_PRIVILEGE),
|
||||||
(errmsg("reference to parent directory (\"..\") not allowed"))));
|
errmsg("reference to parent directory (\"..\") not allowed")));
|
||||||
|
|
||||||
/*
|
/*
|
||||||
* Allow absolute paths if within DataDir or Log_directory, even
|
* Allow absolute paths if within DataDir or Log_directory, even
|
||||||
@ -89,12 +89,12 @@ convert_and_check_filename(text *arg)
|
|||||||
!path_is_prefix_of_path(Log_directory, filename)))
|
!path_is_prefix_of_path(Log_directory, filename)))
|
||||||
ereport(ERROR,
|
ereport(ERROR,
|
||||||
(errcode(ERRCODE_INSUFFICIENT_PRIVILEGE),
|
(errcode(ERRCODE_INSUFFICIENT_PRIVILEGE),
|
||||||
(errmsg("absolute path not allowed"))));
|
errmsg("absolute path not allowed")));
|
||||||
}
|
}
|
||||||
else if (!path_is_relative_and_below_cwd(filename))
|
else if (!path_is_relative_and_below_cwd(filename))
|
||||||
ereport(ERROR,
|
ereport(ERROR,
|
||||||
(errcode(ERRCODE_INSUFFICIENT_PRIVILEGE),
|
(errcode(ERRCODE_INSUFFICIENT_PRIVILEGE),
|
||||||
(errmsg("path must be in or below the current directory"))));
|
errmsg("path must be in or below the current directory")));
|
||||||
|
|
||||||
return filename;
|
return filename;
|
||||||
}
|
}
|
||||||
@ -218,10 +218,10 @@ pg_read_file(PG_FUNCTION_ARGS)
|
|||||||
if (!superuser())
|
if (!superuser())
|
||||||
ereport(ERROR,
|
ereport(ERROR,
|
||||||
(errcode(ERRCODE_INSUFFICIENT_PRIVILEGE),
|
(errcode(ERRCODE_INSUFFICIENT_PRIVILEGE),
|
||||||
(errmsg("must be superuser to read files with adminpack 1.0"),
|
errmsg("must be superuser to read files with adminpack 1.0"),
|
||||||
/* translator: %s is a SQL function name */
|
/* translator: %s is a SQL function name */
|
||||||
errhint("Consider using %s, which is part of core, instead.",
|
errhint("Consider using %s, which is part of core, instead.",
|
||||||
"pg_file_read()"))));
|
"pg_file_read()")));
|
||||||
|
|
||||||
/* handle optional arguments */
|
/* handle optional arguments */
|
||||||
if (PG_NARGS() >= 3)
|
if (PG_NARGS() >= 3)
|
||||||
|
@ -26,7 +26,7 @@ do { \
|
|||||||
if (!IsBinaryUpgrade) \
|
if (!IsBinaryUpgrade) \
|
||||||
ereport(ERROR, \
|
ereport(ERROR, \
|
||||||
(errcode(ERRCODE_CANT_CHANGE_RUNTIME_PARAM), \
|
(errcode(ERRCODE_CANT_CHANGE_RUNTIME_PARAM), \
|
||||||
(errmsg("function can only be called when server is in binary upgrade mode")))); \
|
errmsg("function can only be called when server is in binary upgrade mode"))); \
|
||||||
} while (0)
|
} while (0)
|
||||||
|
|
||||||
Datum
|
Datum
|
||||||
|
@ -7993,7 +7993,7 @@ AlterSystemSetConfigFile(AlterSystemStmt *altersysstmt)
|
|||||||
if (!superuser())
|
if (!superuser())
|
||||||
ereport(ERROR,
|
ereport(ERROR,
|
||||||
(errcode(ERRCODE_INSUFFICIENT_PRIVILEGE),
|
(errcode(ERRCODE_INSUFFICIENT_PRIVILEGE),
|
||||||
(errmsg("must be superuser to execute ALTER SYSTEM command"))));
|
errmsg("must be superuser to execute ALTER SYSTEM command")));
|
||||||
|
|
||||||
/*
|
/*
|
||||||
* Extract statement arguments
|
* Extract statement arguments
|
||||||
|
Loading…
x
Reference in New Issue
Block a user