How to deal with mutually recursive inserts
问题 I have a model that defines mutually recursive tables: Answer questionId QuestionId text Question text correct AnswerId What do I need to do to actually insert a question? I need to know what the correct answer is first. But to insert an answer, I need to know what question it answers. I'm running Postgres, if it matters. The DDL is: CREATE TABLE answer ( id integer NOT NULL, -- answer id text character varying NOT NULL, -- answer text question_id bigint NOT NULL -- question id ); CREATE