Hi there, the forwarding works, it just doesn't get logged so Forward Tracking always reports "No one has used Forward yet." and my logs are getting filled up with SQL errors due to the lack of tables to query. I love this module, but it would be even better if I could see if it actually was working on my site.

pg_query() [<a href='function.pg-query'>function.pg-query</a>]: Query failed: ERROR: there is no unique constraint matching given keys for referenced table &quot;node&quot; in /var/www/<redacted>/includes/database.pgsql.inc on line 125.

query: CREATE TABLE forward_log ( nid integer references node (nid) NOT NULL, type text NOT NULL, timestamp integer NOT NULL ) in /var/www/<redacted>/includes/database.pgsql.inc on line 144.

pg_query() [<a href='function.pg-query'>function.pg-query</a>]: Query failed: ERROR: syntax error at or near &quot;KEY&quot; at character 269 in /var/www/<redacted>/includes/database.pgsql.inc on line 125.

query: CREATE TABLE forward_statistics ( nid integer NOT NULL, last_forward_timestamp integer NOT NULL default &#039;0&#039;, forward_count integer NOT NULL default &#039;0&#039;, clickthrough_count integer NOT NULL default &#039;0&#039;, PRIMARY KEY (nid) KEY (last_forward_timestamp) ) in /var/www/<redacted>/includes/database.pgsql.inc on line 144.

Comments

seanr’s picture

Got any advice on how to fix it? I've never used pgsql (all of my sites are mysql), so me trying to write pgsql queries is a bit of a crapshoot. ;-)

suzanne.aldrich’s picture

Status: Active » Needs review
StatusFileSize
new832 bytes

With the kind help of kryptt on irc, we figured out how the postgresql tables should be created: http://drupalbin.com/278

When creating the forward_log table, nid integer references node (nid) NOT NULL should be nid integer NOT NULL.

When creating the forward_install table, you don't need this: KEY (last_forward_timestamp).

Attached is a patch for your review. My tests indicated that my db now contains both tables, and they are recording forwards and clickthroughs. (The queries for the block and views are throwing errors, which I shall have to open in another issue. I have a lot of problems with views and pgsql queries. Argh.)

seanr’s picture

Status: Needs review » Fixed

Fixed in CVS; will appear in the next release this afternoon. Thank you very much for helping to track this down. If you do get anywhere with views, please let me know, though realize that may be an issue with views and not forward. Either way, post it here and then we'll switch it to views if necessary.

BTW, just out of curiosity, why do people use pgsql? Seems to me that mysql is much more widely supported; is there something that pgsql does that makes it better for certain applications? Thanks.

Anonymous’s picture

Status: Fixed » Closed (fixed)

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