• In theory the above INSERT statement should throw a foreign constraint error...

    I thought so, too.  I guess this is an interesting application of the UNION ALL statement.  It seems that all the statements are handled in a transaction, then the foreign key constraint is checked.  If you run separate INSERT statements, then the anticipated foreign constraint error does occur.  This will have to be filed away in the grey matter as an interesting trick or gadget when needed for a future application.



    Mark