Use correct errorCode for the errors thrown during recovery (#7146)

pull/7152/head
Onur Tirtir 2023-08-28 11:03:38 +03:00 committed by GitHub
parent afab879de3
commit d5d1684c45
No known key found for this signature in database
GPG Key ID: 4AEE18F83AFDEB23
2 changed files with 6 additions and 3 deletions

View File

@ -425,7 +425,8 @@ EnsureCopyCanRunOnRelation(Oid relationId)
*/
if (RecoveryInProgress() && WritableStandbyCoordinator)
{
ereport(ERROR, (errmsg("COPY command to Citus tables is not allowed in "
ereport(ERROR, (errcode(ERRCODE_READ_ONLY_SQL_TRANSACTION),
errmsg("COPY command to Citus tables is not allowed in "
"read-only mode"),
errhint("All COPY commands to citus tables happen via 2PC, "
"and 2PC requires the database to be in a writable state."),

View File

@ -354,7 +354,8 @@ EnsureModificationsCanRun(void)
{
if (RecoveryInProgress() && !WritableStandbyCoordinator)
{
ereport(ERROR, (errmsg("writing to worker nodes is not currently allowed"),
ereport(ERROR, (errcode(ERRCODE_READ_ONLY_SQL_TRANSACTION),
errmsg("writing to worker nodes is not currently allowed"),
errdetail("the database is read-only")));
}
@ -415,7 +416,8 @@ EnsureModificationsCanRunOnRelation(Oid relationId)
if (modifiedTableReplicated)
{
ereport(ERROR, (errmsg("writing to worker nodes is not currently "
ereport(ERROR, (errcode(ERRCODE_READ_ONLY_SQL_TRANSACTION),
errmsg("writing to worker nodes is not currently "
"allowed for replicated tables such as reference "
"tables or hash distributed tables with replication "
"factor greater than 1."),