会话1中执行:
highgo=# create temporary table tmp_t (id int);
CREATE TABLE
highgo=# \d
List of relations
Schema | Name | Type | Owner
----------------+---------+-------+--------
oracle_catalog | dual | view | highgo
pg_temp_2 | tmp_t | table | highgo
public | bindump | table | highgo
public | hexdump | table | highgo
public | t | table | highgo
public | test | table | highgo
public | testa | table | highgo
public | testb | table | highgo
public | testc | table | highgo
public | testd | table | highgo
(10 rows)
从以上可以看出,临时表是在schema下生成的一个特殊的表,合格schema的名称为“pg_temp_xx”,其中xx代表一个数字,如2、3等,但不同的session这个数字是不同的。
会话2中执行&