fix bug of check_client_encoding_hook error
This commit is contained in:
@ -686,13 +686,13 @@ bool check_mix_replication_param(bool* newval, void** extra, GucSource source)
|
||||
/*
|
||||
* SET CLIENT_ENCODING
|
||||
*/
|
||||
void (*check_client_encoding_hook)(void);
|
||||
bool check_client_encoding(char** newval, void** extra, GucSource source)
|
||||
{
|
||||
int encoding;
|
||||
const char* canonical_name = NULL;
|
||||
if (check_client_encoding_hook)
|
||||
check_client_encoding_hook();
|
||||
if (t_thrd.autonomous_cxt.check_client_encoding_hook) {
|
||||
t_thrd.autonomous_cxt.check_client_encoding_hook();
|
||||
}
|
||||
/* Look up the encoding by name */
|
||||
encoding = pg_valid_client_encoding(*newval);
|
||||
if (encoding < 0) {
|
||||
|
@ -706,7 +706,7 @@ void autonomous_worker_main(Datum main_arg)
|
||||
save_log_duration = u_sess->attr.attr_sql.log_duration;
|
||||
save_log_min_duration_statement = u_sess->attr.attr_storage.log_min_duration_statement;
|
||||
|
||||
check_client_encoding_hook = autonomous_check_client_encoding_hook;
|
||||
t_thrd.autonomous_cxt.check_client_encoding_hook = autonomous_check_client_encoding_hook;
|
||||
u_sess->attr.attr_common.log_statement = LOGSTMT_NONE;
|
||||
u_sess->attr.attr_sql.log_duration = false;
|
||||
u_sess->attr.attr_storage.log_min_duration_statement = -1;
|
||||
@ -717,7 +717,7 @@ void autonomous_worker_main(Datum main_arg)
|
||||
u_sess->attr.attr_common.log_statement = save_log_statement;
|
||||
u_sess->attr.attr_sql.log_duration = save_log_duration;
|
||||
u_sess->attr.attr_storage.log_min_duration_statement = save_log_min_duration_statement;
|
||||
check_client_encoding_hook = NULL;
|
||||
t_thrd.autonomous_cxt.check_client_encoding_hook = NULL;
|
||||
|
||||
ReadyForQuery((CommandDest)t_thrd.postgres_cxt.whereToSendOutput);
|
||||
break;
|
||||
|
@ -1389,6 +1389,7 @@ static void knl_t_autonomous_init(knl_t_autonomous_context* autonomous_cxt)
|
||||
autonomous_cxt->isnested = false;
|
||||
autonomous_cxt->handle = NULL;
|
||||
autonomous_cxt->sqlstmt = NULL;
|
||||
autonomous_cxt->check_client_encoding_hook = NULL;
|
||||
}
|
||||
|
||||
static void knl_t_mot_init(knl_t_mot_context* mot_cxt)
|
||||
|
@ -28,7 +28,6 @@ extern bool check_transaction_deferrable(bool* newval, void** extra, GucSource s
|
||||
extern bool check_random_seed(double* newval, void** extra, GucSource source);
|
||||
extern void assign_random_seed(double newval, void* extra);
|
||||
extern const char* show_random_seed(void);
|
||||
extern void (*check_client_encoding_hook)(void);
|
||||
extern bool check_client_encoding(char** newval, void** extra, GucSource source);
|
||||
extern void assign_client_encoding(const char* newval, void* extra);
|
||||
extern bool check_mix_replication_param(bool* newval, void** extra, GucSource source);
|
||||
|
@ -2662,10 +2662,12 @@ typedef struct knl_t_heartbeat_context {
|
||||
|
||||
/* autonomous_transaction */
|
||||
struct PLpgSQL_expr;
|
||||
typedef void (*check_client_encoding_hook_type)(void);
|
||||
typedef struct knl_t_autonomous_context {
|
||||
PLpgSQL_expr* sqlstmt;
|
||||
bool isnested;
|
||||
BackgroundWorkerHandle* handle;
|
||||
check_client_encoding_hook_type check_client_encoding_hook;
|
||||
} knl_t_autonomous_context;
|
||||
|
||||
/* MOT thread attributes */
|
||||
|
Reference in New Issue
Block a user