I find this module invaluable but on one of my sites can only use Postgres.

CommentFileSizeAuthor
#6 subscriptions.patch5.77 KBroderik

Comments

adrian’s picture

Assigned: Unassigned » vertice@www.drop.org

Looking into it.

if you would like it to go faster by helping with testing, please contact me on adrian_at_removethis_dot_daemon_dot_co_za

hystrix’s picture

Adrian supplied me the following table creation.

CREATE TABLE subscriptions(
  sid      integer not null,
  uid      integer not null,
  stype    text not null
);

When I enable the module, the following errors appear on the front page.

warning: PostgreSQL query failed:  ERROR:  Attribute "node" not found
 in /usr/share/pear/DB/pgsql.php on line 173.
warning: Supplied argument is not a valid PostgreSQL result resource
 in /usr/share/pear/DB/pgsql.php on line 396.
user error: DB Error: unknown error
query: SELECT td.tid, td.name, n.nid, n.title 
FROM((subscriptions s LEFT JOIN node n  ON n.nid = s.sid)
LEFT JOIN term_node tn ON tn.nid = s.sid) LEFT 
JOIN term_data td ON td.tid = tn.tid WHERE n.status = 1
AND s.uid = 1 AND s.stype = "node"  in 
/home/group/awg/public_html/includes/database.pear.inc on line 89.
warning: PostgreSQL query failed:  ERROR:  Attribute "taxa" not found
 in /usr/share/pear/DB/pgsql.php on line 173.
warning: Supplied argument is not a valid PostgreSQL result 
resource in /usr/share/pear/DB/pgsql.php on line 396.
user error: DB Error: unknown error
query: SELECT td.tid, td.name FROM subscriptions s INNER JOIN term_data 
td ON td.tid = s.sid WHERE s.uid = 1 AND s.stype = "taxa" in 
/home/group/awg/public_html/includes/database.pear.inc on line 89.
killes@www.drop.org’s picture

Title: PosgreSQL Support » SQL definition broken (was: PosgreSQL Support)
Category: feature » bug

Both the pgsql table by adrian and the mysql table in cvs do not seem to match what the module expects. From reading the code I infer that there should be a "stype" column, and probably some more.

TDobes’s picture

Title: SQL definition broken (was: PosgreSQL Support) » PosgreSQL Support
Category: bug » feature

killes:
subscriptions.mysql defines:

sid      int(10) unsigned not null,
uid      int(10) unsigned not null,
<strong>stype    varchar(4) not null</strong>

I spent a few minutes searching through the code and reviewing every db_query... As far as I can tell, they all refer only to the fields defined above. Perhaps you were accidentially looking at version 1.1 of subscriptions.mysql? Both the 4.3 and 4.4 versions use version 1.2. Therefore, I'm turning this back into a pgsql request.

hystrix’s picture

Verified that the 4.4.0 version of subscriptions with postgresql 7.3 on drupal 4.4.1 still produces the errors I posted previously.

roderik’s picture

StatusFileSize
new5.77 KB

It's not the columns which are a problem; it's the string values. As far as I can tell, you have to use single quotes for PostgreSQL, not double quotes.

Here's a patch against the 4.4.0 module.

(I just finished installing the subscriptions module on my box, getting it to work on PostgreSQL, and _afterwards_ finding this issue. The patch contains a little more than the PostgreSQL fixes:
- translation fixes -- I think that HTML tags should be taken _outside_ the t() function. (Oh, and I replaced {p/} by {/p} somewhere)
- I think in subscriptions_user() you want to refer to 'case "edit_form"', not "edit"

I hope it's OK that the patch fixes more than the bug report is about - if not, tell me :) )

hystrix’s picture

Thanks Roderick. This appears to have solved the problem. I was able to manage my subscriptions without error. I haven't verified receiving email yet, but that shouldn't be affected by this.

Suggest this patch be applied to cvs, and the psql table creation file be included in the distribution.

Anonymous’s picture

ttt’s picture

The patch didn't make it into 4.5.0. (was it supposed to?) Double quotes are still causing problems in PostgreSQL.

TDobes’s picture

I have committed a modified version of the patch provided by Roderik, as well as the table provided by adrian to both the 4.5 and HEAD branch. Thank you all for your help on this. If there are still any remaining issues with PostgreSQL, please re-open this issue and provide details.

Anonymous’s picture