Posted by Damien Tournoud on August 10, 2008 at 3:37pm
Jump to:
| Project: | Drupal core |
| Version: | 7.x-dev |
| Component: | search.module |
| Category: | bug report |
| Priority: | normal |
| Assigned: | Unassigned |
| Status: | closed (fixed) |
Issue Summary
PostgreSQL (at least on 8.3), returns an error when AND is used between and integer and a boolean. The search module is bitten by that, because it sometimes generates queries such as:
SELECT xxx FROM yyy WHERE 1 AND (i.word = ?)Here is a patch.
| Attachment | Size | Status | Test result | Operations |
|---|---|---|---|---|
| search-postgres-and.patch | 880 bytes | Ignored: Check issue status. | None | None |
Comments
#1
A better solution might be to remove the
WHERE 1or theWHERE 1 = 1?#2
This will be much simpler to do as part of #258998: do_search refactoring: performance, legibility, move validation to validation/submit handlers of form., I will post a note there.
In the meantime, I would like to see the simple fix here committed, as it probably breaks search on 6.x.
#3
OK, let's go with this fix for the time being. Committed to CVS HEAD and DRUPAL-6. Thanks.
#4
If postgresql can't take 1 for TRUE then it's broken and we should drop support. Not for the first time we committed a hack just to support a database where the theory fanatics so galopped away that it's no longer useable for a web app.
Edit: why a web app? Because with a web app, much less than a desktop app, you need casting all the time -- whatever comes from the browser is a string etc.
#5
If the work-around has been committed and the proper fix will be a part of #258998: do_search refactoring: performance, legibility, move validation to validation/submit handlers of form., isn't this fixed now?
#6
Automatically closed -- issue fixed for two weeks with no activity.