Hi all,

I have just installed and enabled the FAQ-module on a Drupal 7.9-site with a Postgres backend.

I added one first entry, which can be displayed as expected.

The faq-page (the listing of faq-entries) however returns an error "The website encountered an unexpected error. Please try again later.":

PDOException: SQLSTATE[42704]: Undefined object: 7 FEHLER: Typ »signed« existiert nicht LINE 1: ...eated AS ncreated, COALESCE(w.weight, CAST('0' as SIGNED)) A... ^: SELECT n.nid AS nid, n.sticky AS nsticky, n.created AS ncreated, COALESCE(w.weight, CAST(:default_weight as SIGNED)) AS effective_weight FROM {node} n LEFT OUTER JOIN {faq_weights} w ON w.nid=n.nid WHERE (n.type = :db_condition_placeholder_0) AND (n.status = :db_condition_placeholder_1) AND( (w.tid = :db_condition_placeholder_2) OR (w.tid IS NULL ) ) ORDER BY effective_weight ASC, n.sticky DESC, n.created DESC; Array ( [:db_condition_placeholder_0] => faq [:db_condition_placeholder_1] => 1 [:db_condition_placeholder_2] => 0 [:default_weight] => 0 ) in faq_page() (line 490 of /var/www/drupal/7.x_sites/xxx.yyy.de/modules/faq/faq.module).

Sorry for most of the output being in German, still, I think the terms allow to get the problem.

My guess is that this is related to the DB-backend I am using. I observed the same behaviour with current dev-snapshots. It seams that there is a datatype "signed" used in the module, which may not be supported in SQL and Drupal:

Drupal data-types: http://drupal.org/node/159605
Postgres data-types: http://www.postgresql.org/docs/8.4/static/datatype-numeric.html

I am not really a php developer, but maybe this is a useful hint to track the problem.

Cheers, Lars.

Comments

Samael27’s picture

I have the same error and I don't know how to fix it. I'm still looking but if someone found before me thanks to share with a litlle drupal user :)

grobe’s picture

OK, for me, changing all occurances of SIGNED to INT in faq.module and faq.admin.inc solved the problem. And my guess (!) is that this would work in general. However, I am really not a php developer and would not recommend to trust in my experiments - which is also why I will not post this as a patch here. In case any of the developers are looking into this, I hope they can somehow assess the "fix" better.

Cheers, Lars.

stella’s picture

Status: Active » Postponed (maintainer needs more info)

Changing SIGNED to INT doesn't work as it breaks MySQL.

The error you pasted in would generate the SQL query:

SELECT n.nid AS nid, n.sticky AS nsticky, n.created AS ncreated, COALESCE(w.weight, CAST(0 as SIGNED)) AS effective_weight FROM node n LEFT OUTER JOIN faq_weights w ON w.nid=n.nid WHERE (n.type = 'faq') AND (n.status = 1) AND( (w.tid = 0) OR (w.tid IS NULL ) ) ORDER BY effective_weight ASC, n.sticky DESC, n.created DESC;

We may not need the CAST at all since we're using COALESCE now. Can you run this query manually against your postgres db for me and paste in the results?

SELECT n.nid AS nid, n.sticky AS nsticky, n.created AS ncreated, COALESCE(w.weight, 0) AS effective_weight FROM node n LEFT OUTER JOIN faq_weights w ON w.nid=n.nid WHERE (n.type = 'faq') AND (n.status = 1) AND( (w.tid = 0) OR (w.tid IS NULL ) ) ORDER BY effective_weight ASC, n.sticky DESC, n.created DESC;
stella’s picture

Status: Postponed (maintainer needs more info) » Fixed

The dev version contains a fix for this now. Be sure to test it out and let me know how you get on.

Status: Fixed » Closed (fixed)

Automatically closed -- issue fixed for 2 weeks with no activity.

grobe’s picture

Version: 7.x-1.0-rc1 » 7.x-1.0-rc2

Sorry for being late with my reply.

I updated the module to 7.x-1.0-rc2, and the error did not occur any more. So this seams to be fixed.

Thank you!