Redshift ERROR: relation "Temp table" does not exist

Redshift ERROR: relation "Temp table" does not exist

在 AWS Redshift 下

我用

创建了一个临时 table
select all 
*
into temp table #cleaned_fact
from fact_table
limit 100

获得

Executed successfully

Updated 0 rows in 0.716 seconds.

并尝试使用

检查临时table中的数据
select *
from #cleaned_fact

得到错误

ERROR: relation "#cleaned_fact" does not exist

============================================= ========== 更新 1.

小心

The temp table exists only for duration of your session using which you have created the table.

    create temp table IF NOT EXISTS #cleaned_fact
(
col1 INT NOT NULL encode delta,
col2 INT NOT NULL encode mostly16,
col3 INT NOT NULL encode runlength,
col4 BIGINT NOT NULL encode mostly32,
);
insert into #cleaned_fact
select *
from fact_channel_posting
limit 100

returns

Executed successfully

Updated 100 rows in 3.101 seconds.

但在另一个会话中 select * 来自 #cleaned_fact 仍然 returns 相同的错误

尝试以这种方式创建临时文件table

CREATE [TEMPORARY] TABLE [IF NOT EXISTS] tbl_name
[(create_definition,...)]
[table_options]
select_statement



CREATE TEMPORARY TABLE IF NOT EXISTS mytable
(id int(11) NOT NULL, PRIMARY KEY (id)) ENGINE=MyISAM;
INSERT IGNORE INTO mytable SELECT id FROM table WHERE xyz;

更新1中的策略成功。问题是:

The temp table exists only for duration of your session using which you have created the table.