There are certain parameters that we need during execution that need to persist across transactions.
current_database: The database that the client is currently connected to. This is currently called default_database in the code.
temp_namespace: This is the namespace (schema in Postgres parlance) where all temp tables will get created. Anytime that we need to do a look-up in the catalog for a table or an index, we should check this namespace first. If it doesn't exist, then we will check the 'public' namespace.
In going through #1345, I found that they were passing around the temp_namespace all over the place. They were storing it multiple places in the traffic_cop, binder, optimizer, and execution plans. The correct place to store it is in the TransactionContext. But since a session can have multiple transactions, we actually want to persist it outside of the TransactionContext and reuse it as much as possible.
I propose that we create a new object called SessionObject. This will be created by the TrafficCop for a new connection/session. Then this parameter is passed into TransactionManager::BeginTransaction as a shared-pointer and stored in the TransactionContext.
There are certain parameters that we need during execution that need to persist across transactions.
current_database
: The database that the client is currently connected to. This is currently calleddefault_database
in the code.temp_namespace
: This is the namespace (schema in Postgres parlance) where all temp tables will get created. Anytime that we need to do a look-up in the catalog for a table or an index, we should check this namespace first. If it doesn't exist, then we will check the 'public' namespace.In going through #1345, I found that they were passing around the
temp_namespace
all over the place. They were storing it multiple places in the traffic_cop, binder, optimizer, and execution plans. The correct place to store it is in theTransactionContext
. But since a session can have multiple transactions, we actually want to persist it outside of theTransactionContext
and reuse it as much as possible.I propose that we create a new object called
SessionObject
. This will be created by theTrafficCop
for a new connection/session. Then this parameter is passed intoTransactionManager::BeginTransaction
as a shared-pointer and stored in theTransactionContext
.