error message is not proper for analyze on standby.

Started by Tomonari Katsumataover 13 years ago1 messages
#1Tomonari Katsumata
t.katsumata1122@gmail.com
1 attachment(s)

Hi,

I work with streaming replication and hot standby.
and I noticed that error message is not proper when I issue
ANALYZE command to standby.

[before]
========================================================
-bash-3.2$ psql -c "analyze"
ERROR: cannot execute VACUUM during recovery
STATEMENT: analyze
ERROR: cannot execute VACUUM during recovery
========================================================

ANALYZE command is not VACUUM command.
I attached a patch revised the message.

[after]
========================================================
-bash-3.2$ psql -c "analyze"
ERROR: cannot execute ANALYZE during recovery
STATEMENT: analyze
ERROR: cannot execute ANALYZE during recovery
========================================================

this is not big problem, but error message should be
report actual thing.
please check it.

regards,

-------------
Tomonari Katsumata

Attachments:

analyze_message_on_hotstandby.patchapplication/octet-stream; name=analyze_message_on_hotstandby.patchDownload
diff --git a/src/backend/tcop/utility.c b/src/backend/tcop/utility.c
index fde2c82..bd907fe 100644
--- a/src/backend/tcop/utility.c
+++ b/src/backend/tcop/utility.c
@@ -1124,7 +1124,10 @@ standard_ProcessUtility(Node *parsetree,
 
 		case T_VacuumStmt:
 			/* we choose to allow this during "read only" transactions */
-			PreventCommandDuringRecovery("VACUUM");
+			if (((VacuumStmt *) parsetree)->options & VACOPT_VACUUM)
+				PreventCommandDuringRecovery("VACUUM");
+			else
+				PreventCommandDuringRecovery("ANALYZE");
 			vacuum((VacuumStmt *) parsetree, InvalidOid, true, NULL, false,
 				   isTopLevel);
 			break;