Hi,

i have to persist a simple state machine.
my problem is how to insert the first state which should reference itself.

CREATE TABLE state
(
ID INTEGER NOT NULL GENERATED ALWAYS AS IDENTITY (START WITH 1, INCREMENT BY 1) constraint STATE_ID_PK primary key, NEXT_STATE_ID integer not null constraint STATE_NEYT_STATE_ID REFERENCES STATE
)


insert into state values (default,  default)

doesn't work:  "Column 'NEXT_STATE_ID' cannot accept a NULL value."


Reply via email to