Using ShURLy with PostgreSQL generate this error:
PDOException: SQLSTATE[42601]: Syntax error: 7 ERROR: syntax error at or near "source" LINE 1: SELECT rid, destination FROM shurly WHERE BINARY source = 's... ^: SELECT rid, destination FROM {shurly} WHERE BINARY source = :q AND active = 1; Array ( [:q] => shurly ) in shurly_boot() (line 179 of /usr/local/drupal/sites/all/modules/shurly/shurly.module).
The cause is due to the use of BINARY, which allows to make a case sensitive query. In PostgreSQL (and SQLite), queries are, by default, case sensitive.
Removing the BINARY syntax resolve this issue.
However, i don't know how to make a good patch for this. I mean, do we need to make a condition for database other than Mysql ? I don't know.
| Comment | File | Size | Author |
|---|---|---|---|
| #16 | postgresql_support-1768672-16.patch | 2.14 KB | jibus |
| #15 | postgresql_support-1768672-15.patch | 2.13 KB | jibus |
| #13 | shurly_postgresql_support-1768672-13.patch | 1.93 KB | jibus |
| #12 | shurly_postgresql_support-1768672-12.patch | 1.91 KB | jibus |
| #11 | shurly_postgresql_support-1768672-11.patch | 1.81 KB | jibus |
Comments
Comment #1
makangus commentedHow about using a binary column? The Schema API says
'binary': A boolean indicating that MySQL should force 'char', 'varchar' or 'text' fields to use case-sensitive binary collation. This has no effect on other database types for which case sensitivity is already the default behavior.It seems like it should make MySQL case sensitive and leave PostgreSQL and SQLite alone.
Comment #2
makangus commentedAdded a hook update to the patch.
Comment #3
jibus commentedHi makangus !
Thanks you very much for your reply and patch.
Tested and it works under PG !
I notice that there is still a BINARY statement aroud:
l874-876
Comment #4
makangus commentedGood catch. How about this?
Comment #5
jibus commentedTested #4,
Everything looks fine: creation / reports / delete OK
Thanks for you quick reply !
Comment #6
jibus commentedOne week later, still no problem !
Set this to RTBC
Comment #7
jibus commentedIs is possible to commit this :) ?
Comment #8
jibus commentedCommitted against 7.x-1.x thanks ! Need to reroll for 6.x
Comment #9
cs_shadow commentedPatch in #4 backported for 6.x-1.x
Comment #10
jibus commentedThe Drupal 6 API for changing field is a different from 7. We need to drop primary key and indexes in order to update the field.
Updated patch.
Comment #11
jibus commentedReroll patch, need only to remove indexes from the field. Forgot to set the ouput.
Comment #12
jibus commentedUpdate patch, missing field definition.
Comment #13
jibus commentedSorry again, this one should be OK.
Comment #14
jibus commentedOk, my knowledge in Drupal 6 Schema was not helpful
Binary is not available as spec. Need to run a manual query
Comment #15
jibus commentedUpdated patch.
Comment #16
jibus commentedHope this will be the last one :)
Comment #17
jibus commentedCommitted against 6.x-1.x
Thanks !