'FROM profile JOIN profile_tag ' .
'ON profile.id = profile_tag.tagger ' .
'WHERE profile_tag.tagger = profile_tag.tagged ' .
- 'AND tag = "%s" ' .
+ "AND tag = '%s' " .
'ORDER BY profile_tag.modified DESC%s';
$profile->query(sprintf($qry, $this->tag, $lim));
$notice->query('SELECT profile_id, max(id) AS max_id ' .
'FROM notice ' .
- 'WHERE created > (now() - ' . $seconds . ') ' .
+ ((common_config('db','type') == 'pgsql') ?
+ 'WHERE extract(epoch from created) > (extract(epoch from now()) - ' . $seconds . ') ' :
+ 'WHERE created > (now() - ' . $seconds . ') ' ) .
'GROUP BY profile_id');
$updates = array();
$notice = new Notice();
$notice->profile_id = $profile_id;
$notice->content = $content;
- $notice->whereAdd('now() - created < ' . common_config('site', 'dupelimit'));
+ if (common_config('db','type') == 'pgsql')
+ $notice->whereAdd('extract(epoch from now() - created) < ' . common_config('site', 'dupelimit'));
+ else
+ $notice->whereAdd('now() - created < ' . common_config('site', 'dupelimit'));
+
$cnt = $notice->count();
return ($cnt == 0);
}