if (PQputCopyData(conn, replybuf, len) <= 0 || PQflush(conn))
{
ereport(ERROR,
- (errmsg("could not send feedback packet: %s",
+ (errcode(ERRCODE_CONNECTION_FAILURE),
+ errmsg("could not send feedback packet: %s",
PQerrorMessage(conn))));
return false;
}
if (PQstatus(streamConn) != CONNECTION_OK)
{
ereport(FATAL,
- (errmsg("could not connect to the primary server: %s",
+ (errcode(ERRCODE_CONNECTION_FAILURE),
+ errmsg("could not connect to the primary server: %s",
PQerrorMessage(streamConn))));
}
if (strcmp(remote_sysid, local_sysid) == 0)
{
ereport(FATAL,
- (errmsg("system identifiers must differ between the nodes"),
+ (errcode(ERRCODE_INVALID_NAME),
+ errmsg("system identifiers must differ between the nodes"),
errdetail("Both system identifiers are %s.", remote_sysid)));
}
else
PQfreemem(errormsg);
ereport(ERROR,
- (errmsg("bdr %s: error in dsn: %s", name, str)));
+ (errcode(ERRCODE_CONFIG_FILE_ERROR),
+ errmsg("bdr %s: error in dsn: %s", name, str)));
}
cur_option = options;
if (strcmp(cur_option->keyword, "dbname") == 0)
{
if (cur_option->val == NULL)
- ereport(ERROR, (errmsg("bdr %s: no dbname set", name)));
+ ereport(ERROR,
+ (errcode(ERRCODE_CONFIG_FILE_ERROR),
+ errmsg("bdr %s: no dbname set", name)));
strncpy(NameStr(opts->dbname), cur_option->val,
NAMEDATALEN);
elog(DEBUG2, "bdr %s: has init_replica=t", name);
if (database_initcons[off] != NULL)
ereport(ERROR,
- (errmsg("Connections %s and %s on database %s both have bdr_init_replica enabled, cannot continue",
+ (errcode(ERRCODE_CONFIG_FILE_ERROR),
+ errmsg("Connections %s and %s on database %s both have bdr_init_replica enabled, cannot continue",
name, database_initcons[off], used_databases[off])));
else
database_initcons[off] = name; /* no need to pstrdup, see _PG_init */
if (!process_shared_preload_libraries_in_progress)
ereport(ERROR,
- (errmsg("bdr can only be loaded via shared_preload_libraries")));
+ (errcode(ERRCODE_CONFIG_FILE_ERROR),
+ errmsg("bdr can only be loaded via shared_preload_libraries")));
if (!commit_ts_enabled)
ereport(ERROR,
if (PQgetisnull(res, 0, 1))
{
ereport(ERROR,
- (errmsg("Remote database for BDR connection %s does not have the bdr extension active",
+ (errcode(ERRCODE_CONFIG_FILE_ERROR),
+ errmsg("Remote database for BDR connection %s does not have the bdr extension active",
NameStr(*bdr_conn_name)),
errdetail("no entry with name 'bdr' in pg_extensions"),
errhint("add 'bdr' to shared_preload_libraries in postgresql.conf "
{
/* bdr ext is not known to Pg at all */
ereport(ERROR,
- (errmsg("Remote PostgreSQL install for bdr connection %s does not have bdr extension installed",
+ (errcode(ERRCODE_CONFIG_FILE_ERROR),
+ errmsg("Remote PostgreSQL install for bdr connection %s does not have bdr extension installed",
NameStr(*bdr_conn_name)),
errdetail("no entry with name 'bdr' in pg_available_extensions; did you install BDR?")));
}
{
LWLockRelease(BdrWorkerCtl->lock);
ereport(ERROR,
- (errmsg("No free bdr worker slots, bdr_max_workers=%d too low",
+ (errcode(ERRCODE_CONFIGURATION_LIMIT_EXCEEDED),
+ errmsg("No free bdr worker slots, bdr_max_workers=%d too low",
bdr_max_workers)));
}
BdrWorkerCtl->slots[worker_shmem_idx].worker_type = BDR_WORKER_APPLY;