Greetings!
I believe I’ve found a bug and have a patch I’d like to submit, but I wanted to check with the forum first to see if there is agreement that it’s a bug and get advice on coding standards before officially submitting.
The issue is that the Gii model builder handles numeric(n,m) Postgres columns as strings. I understand that this is so that precision is not lost, since a numeric column in Postgres is not represented by a float internally, but rather as a decimal type.
However, Gii also builds validation rules for a string for these columns, and it does it incorrectly.
For example, numeric(6,2) will generate a rule like:
array('col', 'length', 'max'=>6),
Which will prevent a number such as 9999.99 from being allowed, as it is 7 characters and fails the validation check.
My patch sets a new type of ‘numeric’ in framework/db/schema/pgsql/CPgsqlColumnSchema.php and instead of writing a “length” rule, it writes a “max” and “min” numerical rule.
One thing I wasn’t sure of is if setting $this->type in CPgsqlColumnSchema has other effects, and whether that field is used by anything else in the framework.
Thanks for any suggestions you might have,
Justin