No visible changes, just refactor how messages are constructed.
if (OidIsValid(iacls->nspid))
ereport(ERROR,
(errcode(ERRCODE_INVALID_GRANT_OPERATION),
- errmsg("cannot use IN SCHEMA clause when using GRANT/REVOKE ON SCHEMAS")));
+ errmsg("cannot use IN SCHEMA clause when using %s",
+ "GRANT/REVOKE ON SCHEMAS")));
objtype = DEFACLOBJ_NAMESPACE;
if (iacls->all_privs && this_privileges == ACL_NO_RIGHTS)
this_privileges = ACL_ALL_RIGHTS_SCHEMA;
if (OidIsValid(iacls->nspid))
ereport(ERROR,
(errcode(ERRCODE_INVALID_GRANT_OPERATION),
- errmsg("cannot use IN SCHEMA clause when using GRANT/REVOKE ON LARGE OBJECTS")));
+ errmsg("cannot use IN SCHEMA clause when using %s",
+ "GRANT/REVOKE ON LARGE OBJECTS")));
objtype = DEFACLOBJ_LARGEOBJECT;
if (iacls->all_privs && this_privileges == ACL_NO_RIGHTS)
this_privileges = ACL_ALL_RIGHTS_LARGEOBJECT;
else
ereport(ERROR,
(errcode(ERRCODE_SYNTAX_ERROR),
- errmsg("unrecognized CLUSTER option \"%s\"",
- opt->defname),
+ errmsg("unrecognized %s option \"%s\"",
+ "CLUSTER", opt->defname),
parser_errposition(pstate, opt->location)));
}
else
ereport(ERROR,
(errcode(ERRCODE_SYNTAX_ERROR),
- errmsg("unrecognized DROP DATABASE option \"%s\"", opt->defname),
+ errmsg("unrecognized %s option \"%s\"",
+ "DROP DATABASE", opt->defname),
parser_errposition(pstate, opt->location)));
}
else
ereport(ERROR,
(errcode(ERRCODE_INVALID_PARAMETER_VALUE),
- errmsg("unrecognized value for EXPLAIN option \"%s\": \"%s\"",
- opt->defname, p),
+ errmsg("unrecognized value for %s option \"%s\": \"%s\"",
+ "EXPLAIN", opt->defname, p),
parser_errposition(pstate, opt->location)));
}
else
else
ereport(ERROR,
(errcode(ERRCODE_INVALID_PARAMETER_VALUE),
- errmsg("unrecognized value for EXPLAIN option \"%s\": \"%s\"",
- opt->defname, p),
+ errmsg("unrecognized value for %s option \"%s\": \"%s\"",
+ "EXPLAIN", opt->defname, p),
parser_errposition(pstate, opt->location)));
}
else if (!ApplyExtensionExplainOption(es, opt, pstate))
ereport(ERROR,
(errcode(ERRCODE_SYNTAX_ERROR),
- errmsg("unrecognized EXPLAIN option \"%s\"",
- opt->defname),
+ errmsg("unrecognized %s option \"%s\"",
+ "EXPLAIN", opt->defname),
parser_errposition(pstate, opt->location)));
}
if (es->generic && es->analyze)
ereport(ERROR,
(errcode(ERRCODE_INVALID_PARAMETER_VALUE),
- errmsg("EXPLAIN options ANALYZE and GENERIC_PLAN cannot be used together")));
+ errmsg("%s options %s and %s cannot be used together",
+ "EXPLAIN", "ANALYZE", "GENERIC_PLAN")));
/* if the summary was not set explicitly, set default value */
es->summary = (summary_set) ? es->summary : es->analyze;
else
ereport(ERROR,
(errcode(ERRCODE_SYNTAX_ERROR),
- errmsg("unrecognized REINDEX option \"%s\"",
- opt->defname),
+ errmsg("unrecognized %s option \"%s\"",
+ "REINDEX", opt->defname),
parser_errposition(pstate, opt->location)));
}
else if (!vacstmt->is_vacuumcmd)
ereport(ERROR,
(errcode(ERRCODE_SYNTAX_ERROR),
- errmsg("unrecognized ANALYZE option \"%s\"", opt->defname),
+ errmsg("unrecognized %s option \"%s\"",
+ "ANALYZE", opt->defname),
parser_errposition(pstate, opt->location)));
/* Parse options available on VACUUM */
else
ereport(ERROR,
(errcode(ERRCODE_SYNTAX_ERROR),
- errmsg("unrecognized VACUUM option \"%s\"", opt->defname),
+ errmsg("unrecognized %s option \"%s\"",
+ "VACUUM", opt->defname),
parser_errposition(pstate, opt->location)));
}
else
ereport(ERROR,
(errcode(ERRCODE_SYNTAX_ERROR),
- errmsg("unrecognized CHECKPOINT option \"%s\"", opt->defname),
+ errmsg("unrecognized %s option \"%s\"",
+ "CHECKPOINT", opt->defname),
parser_errposition(pstate, opt->location)));
}
else
ereport(ERROR,
(errcode(ERRCODE_INVALID_PARAMETER_VALUE),
- errmsg("unrecognized value for CREATE_REPLICATION_SLOT option \"%s\": \"%s\"",
- defel->defname, action)));
+ errmsg("unrecognized value for %s option \"%s\": \"%s\"",
+ "CREATE_REPLICATION_SLOT", defel->defname, action)));
}
else if (strcmp(defel->defname, "reserve_wal") == 0)
{
if (bad_switch)
{
- pg_log_error("options %s and -a/--all cannot be used together", bad_switch);
+ pg_log_error("options %s and %s cannot be used together",
+ bad_switch, "-a/--all");
pg_log_error_hint("Try \"%s --help\" for more information.", progname);
exit(1);
}
dbinfos.objecttypes_to_clean |= OBJECTTYPE_PUBLICATIONS;
else
{
- pg_log_error("invalid object type \"%s\" specified for --clean", cell->val);
+ pg_log_error("invalid object type \"%s\" specified for %s",
+ cell->val, "--clean");
pg_log_error_hint("The valid value is: \"%s\"", "publications");
exit(1);
}
/* reject conflicting "-only" options */
if (data_only && schema_only)
- pg_fatal("options -s/--schema-only and -a/--data-only cannot be used together");
+ pg_fatal("options %s and %s cannot be used together",
+ "-s/--schema-only", "-a/--data-only");
if (schema_only && statistics_only)
- pg_fatal("options -s/--schema-only and --statistics-only cannot be used together");
+ pg_fatal("options %s and %s cannot be used together",
+ "-s/--schema-only", "--statistics-only");
if (data_only && statistics_only)
- pg_fatal("options -a/--data-only and --statistics-only cannot be used together");
+ pg_fatal("options %s and %s cannot be used together",
+ "-a/--data-only", "--statistics-only");
/* reject conflicting "-only" and "no-" options */
if (data_only && no_data)
- pg_fatal("options -a/--data-only and --no-data cannot be used together");
+ pg_fatal("options %s and %s cannot be used together",
+ "-a/--data-only", "--no-data");
if (schema_only && no_schema)
- pg_fatal("options -s/--schema-only and --no-schema cannot be used together");
+ pg_fatal("options %s and %s cannot be used together",
+ "-s/--schema-only", "--no-schema");
if (statistics_only && no_statistics)
- pg_fatal("options --statistics-only and --no-statistics cannot be used together");
+ pg_fatal("options %s and %s cannot be used together",
+ "--statistics-only", "--no-statistics");
/* reject conflicting "no-" options */
if (with_statistics && no_statistics)
- pg_fatal("options --statistics and --no-statistics cannot be used together");
+ pg_fatal("options %s and %s cannot be used together",
+ "--statistics", "--no-statistics");
/* reject conflicting "-only" options */
if (data_only && with_statistics)
"-s/--schema-only", "--statistics");
if (schema_only && foreign_servers_include_patterns.head != NULL)
- pg_fatal("options -s/--schema-only and --include-foreign-data cannot be used together");
+ pg_fatal("options %s and %s cannot be used together",
+ "-s/--schema-only", "--include-foreign-data");
if (numWorkers > 1 && foreign_servers_include_patterns.head != NULL)
- pg_fatal("option --include-foreign-data is not supported with parallel backup");
+ pg_fatal("option %s is not supported with parallel backup",
+ "--include-foreign-data");
if (data_only && dopt.outputClean)
- pg_fatal("options -c/--clean and -a/--data-only cannot be used together");
+ pg_fatal("options %s and %s cannot be used together",
+ "-c/--clean", "-a/--data-only");
if (dopt.if_exists && !dopt.outputClean)
- pg_fatal("option --if-exists requires option -c/--clean");
+ pg_fatal("option %s requires option %s",
+ "--if-exists", "-c/--clean");
/*
* Set derivative flags. Ambiguous or nonsensical combinations, e.g.
* --rows-per-insert were specified.
*/
if (dopt.do_nothing && dopt.dump_inserts == 0)
- pg_fatal("option --on-conflict-do-nothing requires option --inserts, --rows-per-insert, or --column-inserts");
+ pg_fatal("option %s requires option %s, %s, or %s",
+ "--on-conflict-do-nothing",
+ "--inserts", "--rows-per-insert", "--column-inserts");
/* Identify archive format to emit */
archiveFormat = parseArchiveFormat(format, &archiveMode);
pg_fatal("invalid restrict key");
}
else if (dopt.restrict_key)
- pg_fatal("option --restrict-key can only be used with --format=plain");
+ pg_fatal("option %s can only be used with %s",
+ "--restrict-key", "--format=plain");
/*
* Custom and directory formats are compressed by default with gzip when
if (database_exclude_patterns.head != NULL &&
(globals_only || roles_only || tablespaces_only))
{
- pg_log_error("option --exclude-database cannot be used together with -g/--globals-only, -r/--roles-only, or -t/--tablespaces-only");
+ pg_log_error("option %s cannot be used together with %s, %s, or %s",
+ "--exclude-database",
+ "-g/--globals-only", "-r/--roles-only", "-t/--tablespaces-only");
pg_log_error_hint("Try \"%s --help\" for more information.", progname);
exit_nicely(1);
}
/* Make sure the user hasn't specified a mix of globals-only options */
if (globals_only && roles_only)
{
- pg_log_error("options -g/--globals-only and -r/--roles-only cannot be used together");
+ pg_log_error("options %s and %s cannot be used together",
+ "-g/--globals-only", "-r/--roles-only");
pg_log_error_hint("Try \"%s --help\" for more information.", progname);
exit_nicely(1);
}
if (globals_only && tablespaces_only)
{
- pg_log_error("options -g/--globals-only and -t/--tablespaces-only cannot be used together");
+ pg_log_error("options %s and %s cannot be used together",
+ "-g/--globals-only", "-t/--tablespaces-only");
pg_log_error_hint("Try \"%s --help\" for more information.", progname);
exit_nicely(1);
}
if (if_exists && !output_clean)
- pg_fatal("option --if-exists requires option -c/--clean");
+ pg_fatal("option %s requires option %s",
+ "--if-exists", "-c/--clean");
if (roles_only && tablespaces_only)
{
- pg_log_error("options -r/--roles-only and -t/--tablespaces-only cannot be used together");
+ pg_log_error("options %s and %s cannot be used together",
+ "-r/--roles-only", "-t/--tablespaces-only");
pg_log_error_hint("Try \"%s --help\" for more information.", progname);
exit_nicely(1);
}
{
if (opts->filename)
{
- pg_log_error("options -d/--dbname and -f/--file cannot be used together");
+ pg_log_error("options %s and %s cannot be used together",
+ "-d/--dbname", "-f/--file");
pg_log_error_hint("Try \"%s --help\" for more information.", progname);
exit_nicely(1);
}
if (opts->restrict_key)
- pg_fatal("options -d/--dbname and --restrict-key cannot be used together");
+ pg_fatal("options %s and %s cannot be used together",
+ "-d/--dbname", "--restrict-key");
opts->useDB = 1;
}
/* reject conflicting "-only" options */
if (data_only && schema_only)
- pg_fatal("options -s/--schema-only and -a/--data-only cannot be used together");
+ pg_fatal("options %s and %s cannot be used together",
+ "-s/--schema-only", "-a/--data-only");
if (schema_only && statistics_only)
- pg_fatal("options -s/--schema-only and --statistics-only cannot be used together");
+ pg_fatal("options %s and %s cannot be used together",
+ "-s/--schema-only", "--statistics-only");
if (data_only && statistics_only)
- pg_fatal("options -a/--data-only and --statistics-only cannot be used together");
+ pg_fatal("options %s and %s cannot be used together",
+ "-a/--data-only", "--statistics-only");
/* reject conflicting "-only" and "no-" options */
if (data_only && no_data)
- pg_fatal("options -a/--data-only and --no-data cannot be used together");
+ pg_fatal("options %s and %s cannot be used together",
+ "-a/--data-only", "--no-data");
if (schema_only && no_schema)
- pg_fatal("options -s/--schema-only and --no-schema cannot be used together");
+ pg_fatal("options %s and %s cannot be used together",
+ "-s/--schema-only", "--no-schema");
if (statistics_only && no_statistics)
- pg_fatal("options --statistics-only and --no-statistics cannot be used together");
+ pg_fatal("options %s and %s cannot be used together",
+ "--statistics-only", "--no-statistics");
/* reject conflicting "no-" options */
if (with_statistics && no_statistics)
- pg_fatal("options --statistics and --no-statistics cannot be used together");
+ pg_fatal("options %s and %s cannot be used together",
+ "--statistics", "--no-statistics");
/* reject conflicting "only-" options */
if (data_only && with_statistics)
"-s/--schema-only", "--statistics");
if (data_only && opts->dropSchema)
- pg_fatal("options -c/--clean and -a/--data-only cannot be used together");
+ pg_fatal("options %s and %s cannot be used together",
+ "-c/--clean", "-a/--data-only");
if (opts->single_txn && opts->txn_size > 0)
- pg_fatal("options -1/--single-transaction and --transaction-size cannot be used together");
+ pg_fatal("options %s and %s cannot be used together",
+ "-1/--single-transaction", "--transaction-size");
/*
* -C is not compatible with -1, because we can't create a database inside
* a transaction block.
*/
if (opts->createDB && opts->single_txn)
- pg_fatal("options -C/--create and -1/--single-transaction cannot be used together");
+ pg_fatal("options %s and %s cannot be used together",
+ "-C/--create", "-1/--single-transaction");
/* Can't do single-txn mode with multiple connections */
if (opts->single_txn && numWorkers > 1)
opts->no_subscriptions = no_subscriptions;
if (if_exists && !opts->dropSchema)
- pg_fatal("option --if-exists requires option -c/--clean");
+ pg_fatal("option %s requires option %s",
+ "--if-exists", "-c/--clean");
opts->if_exists = if_exists;
opts->strict_names = strict_names;