database: fix aliasing of nested names