Do not reset global_session on RESET ALL
authorPavan Deolasee <[email protected]>
Thu, 18 May 2017 11:13:38 +0000 (16:43 +0530)
committerPavan Deolasee <[email protected]>
Thu, 18 May 2017 11:13:38 +0000 (16:43 +0530)
This avoids resetting global session information when DISCARD/RESET ALL is
executed. This can have bad effects, especially as seen from the 'guc' test
case where we fail to handle temp tables correctly. So we mark global_session
GUC with GUC_NO_RESET_ALL flag and instead issue an explicit RESET
global_session when connection is cleaned up.

src/backend/pgxc/pool/execRemote.c
src/backend/utils/misc/guc.c

index f4b2c7fe2ae78bd6f88432376274681bcbdaedf7..21f155f5f74c92921b690f22f716cb9d1519d1a8 100644 (file)
@@ -1942,8 +1942,10 @@ pgxc_node_remote_cleanup_all(void)
        PGXCNodeHandle *new_connections[handles->co_conn_count + handles->dn_conn_count];
        int                             new_conn_count = 0;
        int                             i;
-       char               *resetcmd = "RESET ALL;RESET SESSION AUTHORIZATION;"
-                                                          "RESET transaction_isolation;";
+       char               *resetcmd = "RESET ALL;"
+                                                          "RESET SESSION AUTHORIZATION;"
+                                                          "RESET transaction_isolation;"
+                                                          "RESET global_session";
 
        elog(DEBUG5, "pgxc_node_remote_cleanup_all - handles->co_conn_count %d,"
                        "handles->dn_conn_count %d", handles->co_conn_count,
index 3d4493fcdd86e8748df64d995be9ea0536acc749..cf1a41fa71e201b260ca2a4f59f17b7e2e30fdbe 100644 (file)
@@ -3586,7 +3586,7 @@ static struct config_string ConfigureNamesString[] =
                {"global_session", PGC_USERSET, UNGROUPED,
                        gettext_noop("Sets the global session identifier."),
                        NULL,
-                       GUC_IS_NAME | GUC_REPORT | GUC_NO_SHOW_ALL | GUC_NOT_IN_SAMPLE | GUC_DISALLOW_IN_FILE | GUC_NOT_WHILE_SEC_REST
+                       GUC_IS_NAME | GUC_REPORT | GUC_NO_RESET_ALL | GUC_NO_SHOW_ALL | GUC_NOT_IN_SAMPLE | GUC_DISALLOW_IN_FILE | GUC_NOT_WHILE_SEC_REST
                },
                &global_session_string,
                "none",