I have a table USER
CREATE TABLE "USER"
(
USER_ID INTEGER NOT NULL ,
CREATED_BY INTEGER NOT NULL ,
) ;
ALTER TABLE "USER" ADD CONSTRAINT USER_PK PRIMARY KEY ( USER_ID ) ;
For this particular database, I need the CREATED_BY table to be a foreign key to USER_ID in the same table.
ALTER TABLE "USER" ADD CONSTRAINT USER_USER_FK FOREIGN KEY ( CREATED_BY ) REFERENCES "USER" ( USER_ID ) ;
Because of this constraint, my insert statement will always fail on the first user.
Is there a best practice for getting around this? Can I disable the constraint for the first user added and then re-enable the constraint?