ATTACH_DB: simplify the code slightly and change the semantics to only