Support for Drupal 7 is ending on 5 January 2025—it’s time to migrate to Drupal 10! Learn about the many benefits of Drupal 10 and find migration tools in our resource center.
After attempting to install this module with a PostgreSQL database, I see the following error messages in the PostgreSQL log file (multiple times):
ERROR: function lpad(bigint, integer, unknown) does not exist at character 119
HINT: No function matches the given name and argument types. You might need to add explicit type casts.
STATEMENT: SELECT count, bundle_md5, filename FROM (SELECT LPAD(COUNT(*), 8, '00000000') AS count, bundle_md5, filename_md5 FROM advagg_bundles WHERE root = 1 AND timestamp > 1319753642 GROUP BY filename_md5) AS ab INNER JOIN advagg_files AS af USING ( filename_md5 )
Anyway, from looking at the documentation for lpad() on PostgreSQL and MySQL, it looks like the first argument is supposed to be a string, whereas count() returns a bigint in PostgreSQL and MySQL. I've attached a patch that casts the return value from count as a char. It works on PostgreSQL, should work with MySQL.
Comment | File | Size | Author |
---|---|---|---|
#5 | 1338188-advagg_lpad_improper_argument-3.patch | 546 bytes | ChrisLaFrancis |
#2 | 1338188-advagg_lpad_improper_argument-2.patch | 536 bytes | ChrisLaFrancis |
advagg-lpad_improper_argument.patch | 533 bytes | ChrisLaFrancis | |
Comments
Comment #1
mikeytown2 CreditAttribution: mikeytown2 commentedComment #2
ChrisLaFrancis CreditAttribution: ChrisLaFrancis commentedSorry, this should be cast to varchar instead of char. New patch attached.
Also, the MySQL documentation for lpad() specifies that the first argument should be a string, too, so I'm not sure this issue is specific to PostgreSQL...
Comment #3
mikeytown2 CreditAttribution: mikeytown2 commentedPatch above has been committed. Thanks!
Comment #4
mikeytown2 CreditAttribution: mikeytown2 commentedheads up #1378640: Question with Error
Comment #5
ChrisLaFrancis CreditAttribution: ChrisLaFrancis commentedIt looks like MySQL can cast to a char, so how about we cast to char(8) instead of varchar? Patch attached.
Comment #6
mikeytown2 CreditAttribution: mikeytown2 commentedVerified this time it works.
Last patch has been committed.
Thanks!