The CONCAT() function takes just 2 arguments on Postgres, and in coder_upgrade_module_list(), it is being used with 4 arguments. The patch below solves the problem.

Comments

solotandem’s picture

Thanks for the patch. May I assume this is the only change needed to work with Postgres?

tamasd’s picture

I haven't found anything else yet.

kehan’s picture

postgres doesn't actually have a concat function, although drupal provides one on installation. I worked around this by writing a postgres function:

-- Function: concat(text, text, text, text)
CREATE OR REPLACE FUNCTION "concat"(text, text, text, text) RETURNS text AS '
SELECT $1 || $2 || $3 || $4;
' LANGUAGE 'sql';

But the above patch works for me as well.

laceysanderson’s picture

This is still an issue on a fresh installation of drupal7. After enabling the coder module, I get the following error:
PDOException: SQLSTATE[42883]: Undefined function: 7 ERROR: function concat(unknown, character varying, unknown, character varying) does not exist LINE 2: REPLACE(filename, CONCAT('/', name, '.', type), ''... ^ HINT: No function matches the given name and argument types. You might need to add explicit type casts.: SELECT name, filename, type, status, info, REPLACE(filename, CONCAT('/', name, '.', type), '') AS directory FROM {system} WHERE type = 'module' AND filename LIKE 'modules/%' AND status = :status ORDER BY directory, name; Array ( [:status] => 0 ) in coder_upgrade_module_list() (line 573 of /var/www/drupal7/sites/all/modules/coder/coder_upgrade/includes/conversion.inc).

I attempted to use the following patch but received an error:

~$ cd sites/all/modules/coder/coder_upgrade
~$ git apply coder_upgrade_pgcompat.patch
error: patch failed: coder_upgrade/coder_upgrade.module:731
error: coder_upgrade/coder_upgrade.module: patch does not apply

This is likely just due to the module changing quite a bit since the patch was made...

laceysanderson’s picture

StatusFileSize
new697 bytes

As suspected it was just because the module has changed a lot since the first patch. The error was in a completely different file (conversion.inc) but otherwise was exactly the same. I created a new patch that uses the same approach that the previous one does (ie: CONCAT(text1, text2, text3, text4) becomes CONCAT(CONCAT(text1, text2), CONCAT(text3, text4))). This solves the problem in my Drupal 7.14 installation allowing me to install the module.

laceysanderson’s picture

Status: Active » Needs review
liam morland’s picture

Issue tags: +PostgreSQL

Tagging

klausi’s picture

Issue summary: View changes
Status: Needs review » Closed (won't fix)

Coder 7.x-1.x is frozen now and will not receive any updates. Coder 8.x-2.x can be used to check code for any Drupal version, Coder 8.x-2.x also supports the phpcbf command to automatically fix conding standard errors. Please check if this issue is still relevant and reopen against that version if necessary.