Skip to content
Browse files

Fixing error introduced by previous commit

  • Loading branch information...
1 parent b3f860b commit 7668894888bc992426f1715a6093c3c7b53bb3bf @lorenzo lorenzo committed
View
2 cake/libs/model/datasources/dbo/dbo_postgres.php
@@ -493,7 +493,7 @@ function __quoteFunctionField($match) {
$match[1] = trim(str_replace('DISTINCT', '', $match[1]));
}
if (strpos($match[1], '.') === false) {
- $match[1] = $this->name($alias . '.' . $match[1]);
+ $match[1] = $this->name($match[1]);
} else {
$parts = explode('.', $match[1]);
if (!Set::numeric($parts)) {
View
8 cake/tests/cases/libs/model/datasources/dbo/dbo_postgres.test.php
@@ -795,6 +795,14 @@ function testQuoteDistinctInFunction() {
$result = $this->db->fields($Article, null, array('COUNT(DISTINCT Article.id)'));
$expected = array('COUNT(DISTINCT "Article"."id")');
$this->assertEqual($result, $expected);
+
+ $result = $this->db->fields($Article, null, array('COUNT(DISTINCT id)'));
+ $expected = array('COUNT(DISTINCT "id")');
+ $this->assertEqual($result, $expected);
+
+ $result = $this->db->fields($Article, null, array('COUNT(DISTINCT FUNC(id))'));
+ $expected = array('COUNT(DISTINCT FUNC("id"))');
+ $this->assertEqual($result, $expected);
}
}
?>

0 comments on commit 7668894

Please sign in to comment.
Something went wrong with that request. Please try again.