Logo Questions Linux Laravel Mysql Ubuntu Git Menu
 

Redshift - unsupported type "serial" for auto increment id with node-orm-2

Any insight on how to get an auto increment id working? From my understanding, an id column is added by default; however, because I'm using Redshift, the default "serial" type won't work as it is not supported.

{ [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' }
like image 321
Nick Parsons Avatar asked Jul 08 '15 17:07

Nick Parsons


1 Answers

No such thing supported.

You can only get an 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.

For a GUID you will have to generate one and insert it yourself.

Example:

CREATE TABLE your_table(
   id INT IDENTITY(1, 1)
);
like image 141
vitaly-t Avatar answered Oct 20 '22 23:10

vitaly-t