return pending_msg_string[type];
}
+/*
+ * Check consistency the message type and backend message kind.
+ * This function is intended to be used for debugging.
+ */
+void pool_check_pending_message_and_reply(POOL_MESSAGE_TYPE type, char kind)
+{
+ /*
+ * Backend response message sorted by POOL_MESSAGE_TYPE
+ */
+ static char backend_response_kind[] = {
+ '1', /* POOL_PARSE, parse complete */
+ '2', /* POOL_BIND, bind complete */
+ '*', /* POOL_EXECUTE, skip checking */
+ '*', /* POOL_DESCRIBE, skip checking */
+ '3', /* POOL_CLOSE, close complete */
+ 'Z' /* POOL_SYNC, ready for query */
+ };
+
+ if (type < POOL_PARSE || type > POOL_SYNC)
+ {
+ ereport(DEBUG1,
+ (errmsg("pool_check_pending_message_and_reply: type out of range: %d", type)));
+ return;
+ }
+
+ if (backend_response_kind[type] == '*')
+ {
+ return;
+ }
+
+ if (backend_response_kind[type] != kind)
+ {
+ ereport(DEBUG1,
+ (errmsg("pool_check_pending_message_and_reply: type: %s but is kind: %c",
+ pool_pending_message_type_to_string(type), kind)));
+ }
+ return;
+}
+
/*
* Find the latest pending message having specified query context. The
* returned message is a pointer to the message list. So do not free it using
*/
typedef enum {
- POOL_PARSE,
+ POOL_PARSE = 0,
POOL_BIND,
POOL_EXECUTE,
POOL_DESCRIBE,
extern POOL_PENDING_MESSAGE *pool_pending_message_get_previous_message(void);
extern bool pool_pending_message_exists(void);
extern const char *pool_pending_message_type_to_string(POOL_MESSAGE_TYPE type);
+extern void pool_check_pending_message_and_reply(POOL_MESSAGE_TYPE type, char kind);
extern POOL_PENDING_MESSAGE *pool_pending_message_find_lastest_by_query_context(POOL_QUERY_CONTEXT *qc);
extern void dump_pending_message(void);
extern void pool_set_major_version(int major);