There is one database query which uses backticks. These break postgres compatibility. Here is the change: Line 176

// Should 300 be overriden in DrupalOAuthServer and made configurable?
db_query("DELETE FROM {oauth_common_nonce}
- WHERE `timestamp` < %d", array(
+ WHERE timestamp < %d", array(
':now' => time() - 300,
));
}

Comments

ben coleman’s picture

Both queries in that function (oath_common_cron) have PostgreSQL compatibility problems. The other query appears to me to use a multi-table DELETE syntax that is peculiar to MySQL.

One question: are the backquotes being used because MySQL needs them (i.e. timestamp is a reserved word and won't be recognized as a column without the quoting)?

On the other query:

db_query("DELETE t, pt FROM {oauth_common_token} t LEFT JOIN {oauth_common_provider_token} pt ON pt.tid = t.tid
WHERE t.expires != 0 AND t.expires <= %d", array(
':now' => time(),
));

Does this result in rows being deleted from both oauth_common_token and oauth_common_provider_token tables? If someone more familiar with MySQL-specific syntax than me can verify this, I'll work on working up the PostgreSQL equivalent.

It's looking to me like we're going to have to to determine whether MySQL or PostgreSQL is in use and use an if statement to choose the appropriate query.

ChrisLaFrancis’s picture

I've rolled a patch that tries to deal with both of these issues. The backticks were removed from the second query, and the first query was broken into two.

ben coleman’s picture

The patch in #2 appears to work. At least, it does not produce any warnings when run by cron (previously, every cron run was producing warnings on both queries).

ChrisLaFrancis’s picture

Status: Active » Needs review
john franklin’s picture

Status: Needs review » Reviewed & tested by the community

Works great on one of my sites, too.

kylebrowning’s picture

Assigned: Unassigned » kylebrowning
ben coleman’s picture

Issue summary: View changes

This has been at RTBC for over 2 years. Is it going to be applied?

  • Commit 3db8d4e on 6.x-3.x authored by fivefrank, committed by juampy:
    Issue #1238752 by aaron1234nz | Ben Coleman | John Franklin | fivefrank...
juampynr’s picture

Status: Reviewed & tested by the community » Fixed

Marking as fixed. Thanks!

Status: Fixed » Closed (fixed)

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