node.js - Redshift - node-orm-2 的自动增量 ID 不支持类型 "serial"

标签 node.js amazon-redshift node-orm2

关于如何让自动递增 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 an IDENTITY column. An IDENTITY 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 an IDENTITY column must be either INT or BIGINT.

对于 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/

相关文章:

MySQL KILL - 进程立即重生

Node.js 延续本地存储使用

javascript - 日志记录会要求单独的良好实践还是杂乱无章?

javascript - PhantomJs:Spawn 未打开任何应用程序

javascript - 删除 JSON 数组中对象之间的逗号

mysql - 如何为 Amazon Redshift 外部表建模以更改列结构?

javascript - 像 Rails 一样,在 Node.js (node-orm) 中链接模型关系

json - 如何读取在node.js中作为命令行参数传递的json字符串?

amazon-web-services - Athena 在 S3 上查询数据的替代方案

node.js - node-orm2 中的引用键