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' }
No such thing supported.
You can only get an 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
.
For a GUID you will have to generate one and insert it yourself.
Example:
CREATE TABLE your_table(
id INT IDENTITY(1, 1)
);
If you love us? You can donate to us via Paypal or buy me a coffee so we can maintain and grow! Thank you!
Donate Us With