SQLite Forum

Bad practice to open AND attach the same database?
Login
I can't dream up any "nasty consequences".  You have simply attached the same database file to a connection twice.  I do not see any purpose nor any direct harm from doing so.

You might run into some two-phase commit problems if you attempt to update both attached copies of the same database from the same connection or with wal mode, but I would presume that SQLite3 would simply raise some sort of error condition if it had a problem and prevent corruption of the database file.

In other words, it would be my expectation that if you tried to do something that was problematic it would be detected and you would be told that you cannot do that, the data would be safe, and you would be the unhappy holder of an error return as a consequence of your actions.  In other words, that the world would unfold as it should.

Anything which causes the data to be corrupted would be a bug in SQLite3 and should be fixed so that condition is prevented from causing corruption.