我几乎从其他用户的代码中复制了几乎所有的内容,用于另一个数据库系统(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%';
redshift说:
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%';
identity
,not null
和primary key
约束在Redshift中不起作用。尝试重新创建没有约束的表,然后尝试插入数据。