Database: fixed getting sequence name if it was renamed [closes #1443]