【问题标题】:Redshift - unsupported type "serial" for auto increment id with node-orm-2Redshift - 使用 node-orm-2 自动递增 id 的不支持类型“serial”
【发布时间】:2015-09-26 17:54:23
【问题描述】:

对如何使自动增量 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' }

【问题讨论】:

    标签: node.js amazon-redshift node-orm2


    【解决方案1】:

    不支持这样的东西。

    你只能得到一个auto-increment for an integer

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

    对于 GUID,您必须自己生成并插入它。

    示例:

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

    【讨论】:

    • 有人可以添加这样的 SQL 创建表示例吗?
    猜你喜欢
    • 1970-01-01
    • 2019-02-10
    • 2012-03-04
    • 1970-01-01
    • 2012-01-09
    • 1970-01-01
    • 1970-01-01
    • 2015-04-15
    • 1970-01-01
    相关资源
    最近更新 更多