解决session退出时系统无权限访问gs_encrypted_table问题

This commit is contained in:
Li Bingchen
2021-05-26 11:04:22 +08:00
parent cb9a184863
commit 6cdeb58856

View File

@ -6764,8 +6764,6 @@ void RemoveTempNamespace()
{
StringInfoData str;
initStringInfo(&str);
StringInfoData str_temp_table;
initStringInfo(&str_temp_table);
if (u_sess->catalog_cxt.myTempNamespace) {
ResourceOwner currentOwner = t_thrd.utils_cxt.CurrentResourceOwner;
@ -6785,13 +6783,11 @@ void RemoveTempNamespace()
if (nspname != NULL) {
ereport(LOG, (errmsg("Session quiting, drop temp schema %s", nspname)));
appendStringInfo(&str, "DROP SCHEMA %s, pg_toast_temp_%s CASCADE", nspname, &nspname[8]);
appendStringInfo(&str_temp_table, "DELETE FROM gs_encrypted_columns WHERE rel_id in ( select pg_class.oid from pg_class join pg_namespace ON (pg_class.relnamespace = pg_namespace.oid ) where pg_namespace.nspname = \'%s\')", nspname);
pgstatCountSQL4SessionLevel();
t_thrd.postgres_cxt.whereToSendOutput = DestNone;
exec_simple_query(str.data, QUERY_MESSAGE);
exec_simple_query(str_temp_table.data, QUERY_MESSAGE);
u_sess->catalog_cxt.myTempNamespace = InvalidOid;
u_sess->catalog_cxt.myTempToastNamespace = InvalidOid;
}