Index: catalog/namespace.c =================================================================== RCS file: /projects/cvsroot/pgsql-server/src/backend/catalog/namespace.c,v retrieving revision 1.63 diff -u -r1.63 namespace.c --- catalog/namespace.c 13 Feb 2004 01:08:20 -0000 1.63 +++ catalog/namespace.c 29 Apr 2004 07:33:49 -0000 @@ -1639,12 +1639,8 @@ * First, do permission check to see if we are authorized to make temp * tables. We use a nonstandard error message here since * "databasename: permission denied" might be a tad cryptic. - * - * Note we apply the check to the session user, not the currently active - * userid, since we are not going to change our minds about temp table - * availability during the session. */ - if (pg_database_aclcheck(MyDatabaseId, GetSessionUserId(), + if (pg_database_aclcheck(MyDatabaseId, GetUserId(), ACL_CREATE_TEMP) != ACLCHECK_OK) ereport(ERROR, (errcode(ERRCODE_INSUFFICIENT_PRIVILEGE), Index: commands/tablecmds.c =================================================================== RCS file: /projects/cvsroot/pgsql-server/src/backend/commands/tablecmds.c,v retrieving revision 1.102 diff -u -r1.102 tablecmds.c --- commands/tablecmds.c 1 Apr 2004 21:28:44 -0000 1.102 +++ commands/tablecmds.c 29 Apr 2004 07:33:49 -0000 @@ -165,8 +165,12 @@ { AclResult aclresult; - aclresult = pg_namespace_aclcheck(namespaceId, GetUserId(), - ACL_CREATE); + if (stmt->relation->istemp) + aclresult = pg_namespace_aclcheck(MyDatabaseId, GetUserId(), + ACL_CREATE_TEMP); + else + aclresult = pg_namespace_aclcheck(namespaceId, GetUserId(), + ACL_CREATE); if (aclresult != ACLCHECK_OK) aclcheck_error(aclresult, ACL_KIND_NAMESPACE, get_namespace_name(namespaceId));