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,
));
}
| Comment | File | Size | Author |
|---|---|---|---|
| #2 | 1238752-oauth-pgsql_compatability.patch | 1 KB | ChrisLaFrancis |
Comments
Comment #1
ben coleman commentedBoth 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.
Comment #2
ChrisLaFrancis commentedI'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.
Comment #3
ben coleman commentedThe 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).
Comment #4
ChrisLaFrancis commentedComment #5
john franklin commentedWorks great on one of my sites, too.
Comment #6
kylebrowning commentedComment #7
ben coleman commentedThis has been at RTBC for over 2 years. Is it going to be applied?
Comment #9
juampynr commentedMarking as fixed. Thanks!