Fixing error introduced by previous commit

This commit is contained in:
José Lorenzo Rodríguez 2010-04-07 09:51:29 -04:30
parent b3f860b762
commit 7668894888
2 changed files with 9 additions and 1 deletions

View file

@ -493,7 +493,7 @@ class DboPostgres extends DboSource {
$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 file

@ -795,6 +795,14 @@ class DboPostgresTest extends CakeTestCase {
$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);
}
}
?>