I'm primarily interested in pgsql for this, but I was wondering if there is a way in any RDBMS to do an insert operation, without disabling and re-enabling any FOREIGN KEY or NOT NULL constraints, on two tables that refer to each other. (You might think of this as a chicken that was somehow born from its own egg.)
For a practical example, if you had a multiple-choice quiz system, with tables "question" and "answer", where question.correct_answer refers to answer.id, and answer.question refers to question.id, is it possible to add a question and its answers simultaneously?
(For the record, I'm aware that you can do the disabling and re-enabling in a transaction block, and that another solution is to not have a correct_answer column but instead have answer.correct as a boolean and have a check constraint making sure there's exactly one correct answer per question. But I'm not curious about alternative solutions here.)