Circular references in one transaction
Tables node_a and node_b reference each other with foreign keys (a cycle). You must insert a linked pair: node_a (1, 1) and node_b (1, 1). Inserting them one by one fails — the first row references a row that does not exist yet. Write a transaction that defers the foreign-key checks to the end and inserts both rows.
Conectează-te pentru a vedea istoricul soluțiilor trimise
Conectează-teConectează-te pentru a folosi Mentorul AI
Conectează-te