【问题标题】:why I get this error in Redshift for select insert into?为什么我在 Redshift for select insert into 中收到此错误?
【发布时间】:2020-01-27 22:27:52
【问题描述】:

我从另一个用户的代码中几乎一字不差地复制了另一个数据库系统(SQL Server 或 Oracle),我需要在 Redshift 中使用。

我创建了一个表:

create table #Tablelist(
    tableid int identity(1,1)
    ,table_name varchar(50) not null
    ,primary key (table_name)
);

但是当我运行这个时:

insert into #Tablelist(table_name)
select distinct tablename
from pg_table_def
where tablename like '%some_pattern%';

红移说:

 Invalid operation: Specified types or functions (one per INFO message) not supported on Redshift tables.;

这部分工作正常:

select distinct tablename
from pg_table_def
where tablename like '%some_pattern%';

【问题讨论】:

    标签: sql select insert amazon-redshift


    【解决方案1】:

    identitynot nullprimary key 约束在 Redshift 中不起作用。尝试在没有约束的情况下重新创建表,然后尝试插入数据。

    【讨论】:

      猜你喜欢
      • 2018-11-06
      • 1970-01-01
      • 1970-01-01
      • 1970-01-01
      • 2018-10-08
      • 1970-01-01
      • 1970-01-01
      • 2018-05-13
      • 2018-06-22
      相关资源
      最近更新 更多