Can't use "GENERATED ALWAYS AS IDENTITY" when creating Postgres tables on Dbeaver?

Viewed 4001

I am using Dbeaver to create a Postgres database table but am getting a syntax error when using "GENERATED ALWAYS AS IDENTITY" for my incremented id value. It is strange because I used the exact same syntax when creating the table on my localhost and had no problem with any syntax errors or creating the table.

This is the SQL preview I have when attempting to save the table:

CREATE TABLE public.conversation (
    id bigint NOT NULL GENERATED ALWAYS AS IDENTITY,
    startdatetime timestamptz NOT NULL,
    enddatetime timestamptz NOT NULL,
    CONSTRAINT conversation_pk PRIMARY KEY (id)
);

When I try to save the table, I get "ERROR: syntax error at or near 'GENERATED'". I thought this was correct syntax considering the SQL is built by Dbeaver itself and it worked fine when creating a local database to test on?

1 Answers

Just use bigserial:

CREATE TABLE public.conversation (
    id bigserial primary key,
    startdatetime timestamptz NOT NULL,
    enddatetime timestamptz NOT NULL
);
Related