Bug 7679: Fix two SQL queries when using patron attributes