database: fix nested name aliasing