Skip to content

Commit

Permalink
CPgsqlColumnSchema can't parse default value for numeric field
Browse files Browse the repository at this point in the history
fixes #2235
  • Loading branch information
cebe committed Jan 28, 2014
1 parent b7638c7 commit e5f7eb2
Show file tree
Hide file tree
Showing 2 changed files with 3 additions and 2 deletions.
1 change: 1 addition & 0 deletions CHANGELOG
Expand Up @@ -7,6 +7,7 @@ Version 1.1.15 under development
--------------------------------
- Bug #268: Fixed Active Record count error when some field name starting from 'count' (nineinchnick)
- Bug #788: createIndex is not using the recommended way to create unique indexes on Postgres (nineinchnick)
- Bug #2235: CPgsqlColumnSchema can't parse default value for numeric field (cebe, pavimus)
- Bug #2378: CActiveRecord::tableName() in namespaced model returned fully qualified class name (velosipedist, cebe)
- Bug #2654: Allow CDbCommand to compose queries without 'from' clause (klimov-paul)
- Bug #2658: CBaseListView, CGridView, CListView: added note about $itemsCssClass and $pagerCssClass properties, they must not contain empty string, null or false values (resurtm)
Expand Down
4 changes: 2 additions & 2 deletions framework/db/schema/pgsql/CPgsqlColumnSchema.php
Expand Up @@ -50,8 +50,8 @@ protected function extractDefault($defaultValue)
$this->defaultValue=null;
elseif(preg_match('/^\'(.*)\'::/',$defaultValue,$matches))
$this->defaultValue=$this->typecast(str_replace("''","'",$matches[1]));
elseif(preg_match('/^-?\d+(\.\d*)?$/',$defaultValue,$matches))
$this->defaultValue=$this->typecast($defaultValue);
elseif(preg_match('/^(-?\d+(\.\d*)?)(::.*)?$/',$defaultValue,$matches))
$this->defaultValue=$this->typecast($matches[1]);
// else is null
}
}

0 comments on commit e5f7eb2

Please sign in to comment.