* pgpool: a language independent connection pool server for PostgreSQL
* written by Tatsuo Ishii
*
- * Copyright (c) 2003-2017 PgPool Global Development Group
+ * Copyright (c) 2003-2022 PgPool Global Development Group
*
* Permission to use, copy, modify, and distribute this software and
* its documentation for any purpose and without fee is hereby
extern int detect_active_sql_transaction_error(POOL_CONNECTION * backend, int major);
extern int detect_query_cancel_error(POOL_CONNECTION * backend, int major);
extern int detect_idle_in_transaction_session_timeout_error(POOL_CONNECTION * backend, int major);
+extern int detect_idle_session_timeout_error(POOL_CONNECTION * backend, int major);
extern bool is_partition_table(POOL_CONNECTION_POOL * backend, Node *node);
extern POOL_STATUS pool_discard_packet(POOL_CONNECTION_POOL * cp);
extern void query_cache_register(char kind, POOL_CONNECTION * frontend, char *database, char *data, int data_len);
#define ADMIN_SHUTDOWN_ERROR_CODE "57P01"
#define CRASH_SHUTDOWN_ERROR_CODE "57P02"
#define IDLE_IN_TRANSACTION_SESSION_TIMEOUT_ERROR_CODE "25P03"
+#define IDLE_SESSION_TIMEOUT_ERROR_CODE "57P05"
static int reset_backend(POOL_CONNECTION_POOL * backend, int qcnt);
static char *get_insert_command_table_name(InsertStmt *node);
return r;
}
+int
+detect_idle_session_timeout_error(POOL_CONNECTION * backend, int major)
+{
+ int r = extract_message(backend, IDLE_SESSION_TIMEOUT_ERROR_CODE, major, 'E', true);
+
+ if (r == SPECIFIED_ERROR)
+ ereport(DEBUG1,
+ (errmsg("detecting idle session timeout error"),
+ errdetail("idle session timeout error message from backend")));
+ return r;
+}
+
/*
* extract_message: extract specified error by an error code.
* returns 0 in case of success or 1 in case of specified error.
{
ereport(FATAL,
(pool_error_code(IDLE_IN_TRANSACTION_SESSION_TIMEOUT_ERROR_CODE),
- errmsg("terminating connection due to idle-in-transaction timeout")));
+ errmsg("terminating connection due to idle-in-transaction session timeout")));
+ }
+
+ /*
+ * connection was terminated due to idle_session_timeout expired
+ */
+ r = detect_idle_session_timeout_error(CONNECTION(backend, i), MAJOR(backend));
+ if (r == SPECIFIED_ERROR)
+ {
+ ereport(FATAL,
+ (pool_error_code(IDLE_SESSION_TIMEOUT_ERROR_CODE),
+ errmsg("terminating connection due to idle session timeout")));
}
/*