Fixes for RESET SESSION patch, per Alvaro. Fix a typo in the RESET
authorNeil Conway <neilc@samurai.com>
Thu, 12 Apr 2007 22:34:45 +0000 (22:34 +0000)
committerNeil Conway <neilc@samurai.com>
Thu, 12 Apr 2007 22:34:45 +0000 (22:34 +0000)
ref page (sorry, my fault!), and simplify the coding of
ResetTempTableNamespace().

doc/src/sgml/ref/reset.sgml
src/backend/catalog/namespace.c
src/include/catalog/namespace.h

index ee26e940314dffe8db7375d5ff1e49e94b8fe2e6..544676671e696b6c63ddefa5c4a33a357a9ba1e9 100644 (file)
@@ -42,7 +42,7 @@ SET <replaceable class="parameter">configuration_parameter</replaceable> TO DEFA
 
   <para>
    The default value is defined as the value that the parameter would
-   have had, if no <command>SET</> ever been issued for it in the
+   have had, if no <command>SET</> had ever been issued for it in the
    current session.  The actual source of this value might be a
    compiled-in default, the configuration file, command-line options,
    or per-database or per-user default settings.  See <xref
@@ -112,7 +112,7 @@ SET <replaceable class="parameter">configuration_parameter</replaceable> TO DEFA
       Releases all temporary resources associated with the current
       session. This has the same effect as executing the following
       command sequence:
-<synopsis>
+<programlisting>
 SET SESSION AUTHORIZATION DEFAULT;
 RESET ALL;
 DEALLOCATE ALL;
@@ -120,7 +120,7 @@ CLOSE ALL;
 UNLISTEN *;
 RESET PLANS;
 RESET TEMP;
-</synopsis>
+</programlisting>
      </para>
     </listitem>
    </varlistentry>
index 4e85bc0ad48f594f2464def2406b6867886b7979..6ed152c3f3da09f0e09d2df73c659ab55f0aa636 100644 (file)
@@ -1946,18 +1946,8 @@ InitTempTableNamespace(void)
 void
 ResetTempTableNamespace(void)
 {
-       char            namespaceName[NAMEDATALEN];
-       Oid                     namespaceId;
-
-       /* find oid */
-       snprintf(namespaceName, sizeof(namespaceName), "pg_temp_%d", MyBackendId);
-       namespaceId = GetSysCacheOid(NAMESPACENAME,
-                                                                CStringGetDatum(namespaceName),
-                                                                0, 0, 0);
-
-       /* clean if exists */
-       if (OidIsValid(namespaceId))
-               RemoveTempRelations(namespaceId);
+       if (OidIsValid(myTempNamespace))
+               RemoveTempRelations(myTempNamespace);
 }
 
 /*
index 79783ce8b31eff24b9e828e2fb7ffdbc5aefd742..9452e9a3b66582a4a97e0a6d88088c5383edc3a3 100644 (file)
@@ -81,6 +81,7 @@ extern char *NameListToQuotedString(List *names);
 extern bool isTempNamespace(Oid namespaceId);
 extern bool isAnyTempNamespace(Oid namespaceId);
 extern bool isOtherTempNamespace(Oid namespaceId);
+extern void ResetTempTableNamespace(void);
 
 extern OverrideSearchPath *GetOverrideSearchPath(MemoryContext context);
 extern void PushOverrideSearchPath(OverrideSearchPath *newpath);
@@ -100,6 +101,4 @@ extern char *namespace_search_path;
 
 extern List *fetch_search_path(bool includeImplicit);
 
-extern void ResetTempTableNamespace(void);
-
 #endif   /* NAMESPACE_H */