Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

Already on GitHub? Sign in to your account

CPgsqlColumnSchema can't parse default value for numeric field #2235

Closed
pavimus opened this Issue Mar 21, 2013 · 0 comments

Comments

Projects
None yet
1 participant

pavimus commented Mar 21, 2013

i'm have in database field of type numeric(3,1) with default value 0. CPgsqlColumnSchema::extractDefault('0::numeric') returns NULL, but must return '0'.

changing last elseif in CPgsqlColumnSchema::extractDefault from

        elseif(preg_match('/^-?\d+(\.\d*)?$/',$defaultValue,$matches))
            $this->defaultValue=$this->typecast($defaultValue);

to

        elseif(preg_match('/^(-?\d+(\.\d*)?)(::.*)?$/',$defaultValue,$matches))
            $this->defaultValue=$this->typecast($matches[1]);

fixes this problem

PS: Yii 1.1.13, postgresql 9.2

@cebe cebe closed this in e5f7eb2 Jan 28, 2014

twiesenthal pushed a commit to twiesenthal/yii that referenced this issue May 21, 2014

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment