[BUGFIX] Database query error for non-workspaces tables