关于如何让自动递增 ID 起作用的任何见解?据我了解,默认情况下会添加一个 id 列;但是,因为我使用的是 Redshift,默认的“串行”类型将无法使用,因为它不受支持。
{ [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' }
最佳答案
不支持这样的东西。
你只能得到一个auto-increment for an integer :
IDENTITY(seed, step)
Clause that specifies that the column is anIDENTITY
column. AnIDENTITY
column contains unique auto-generated values. These values start with the value specified as seed and increment by the number specified as step. The data type for anIDENTITY
column must be eitherINT
orBIGINT
.
对于 GUID,您必须生成一个并自行插入。
示例:
CREATE TABLE your_table(
id INT IDENTITY(1, 1)
);
关于node.js - Redshift - node-orm-2 的自动增量 ID 不支持类型 "serial",我们在Stack Overflow上找到一个类似的问题: https://stackoverflow.com/questions/31299148/