Check temporary table session isolation¶
Open two MySQL connections to the same MatrixOne instance. Run the first block in session A and keep it open; run the second block in session B. A temporary table belongs to its creating session.
Session A
CREATE DATABASE cookbook_temp;
USE cookbook_temp;
CREATE TEMPORARY TABLE session_items(id INT PRIMARY KEY, label VARCHAR(20));
INSERT INTO session_items VALUES(1,'from A');
SELECT * FROM session_items;
Session B
USE cookbook_temp;
CREATE TEMPORARY TABLE session_items(id INT PRIMARY KEY, label VARCHAR(20));
INSERT INTO session_items VALUES(2,'from B');
SELECT * FROM session_items;
Session A again
SELECT * FROM session_items;
Each session reads only its own value. After both sessions close, the temporary tables disappear. Drop the shared test database from a new connection. See the v4.2.4 source test.