diff --git a/src/backend/distributed/commands/multi_copy.c b/src/backend/distributed/commands/multi_copy.c index eeed0a025fe..ec86f3f61ef 100644 --- a/src/backend/distributed/commands/multi_copy.c +++ b/src/backend/distributed/commands/multi_copy.c @@ -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."), diff --git a/src/backend/distributed/metadata/metadata_cache.c b/src/backend/distributed/metadata/metadata_cache.c index 79c21030188..5ccd4a512a8 100644 --- a/src/backend/distributed/metadata/metadata_cache.c +++ b/src/backend/distributed/metadata/metadata_cache.c @@ -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."),