Add tests for custom SQL queries