Redshift – 不支持的types“serial”,用于自动递增id和node-orm-2

任何有关如何获得自动增量ID工作的见解? 根据我的理解,id列是默认添加的; 但是,因为我使用的是Redshift,所以默认的“serial”types将不起作用,因为它不被支持。

{ [error: Column "probe.id" has unsupported type "serial".] name: 'error', length: 165, severity: 'ERROR', code: '0A000', detail: undefined, hint: undefined, position: undefined, internalPosition: undefined, internalQuery: undefined, where: undefined, schema: undefined, table: undefined, column: undefined, dataType: undefined, constraint: undefined, file: '/home/awsrsqa/padb/src/pg/src/backend/parser/parser_analyze.c', line: '3600', routine: 'transformColumnDefinition', model: 'probe' } 

没有这样的事情支持。

你只能得到一个整数的自动增量 :

IDENTITY(seed, step)指定该列是IDENTITY列的子句。 一个IDENTITY列包含唯一的自动生成的值。 这些值以指定为种子的值开始,并按步骤中指定的数量递增。 IDENTITY列的数据types必须是INTBIGINT

对于一个GUID,你将不得不生成一个,然后自己插入。

例:

 CREATE TABLE your_table( id INT IDENTITY(1, 1) );