From a2e13430202eb42b36d142221a03c43bfd3b224a Mon Sep 17 00:00:00 2001 From: Sebastian Ortiz Date: Wed, 2 Apr 2014 09:59:33 -0500 Subject: [PATCH] fixed bug in defition of decimal types A postgresql column of type numeric(10,4) was mapped as just decimal, so the parse_decimal of dal.py will fail. The correct mapping is decimal(10,4) in the web2py model. --- scripts/extract_pgsql_models.py | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/scripts/extract_pgsql_models.py b/scripts/extract_pgsql_models.py index 79a1699f..3c8841af 100644 --- a/scripts/extract_pgsql_models.py +++ b/scripts/extract_pgsql_models.py @@ -121,9 +121,9 @@ def define_field(conn, table, field, pks): elif field['data_type'] in ('time', 'time without time zone'): f['type'] = "'time'" elif field['data_type'] in ('numeric', 'currency'): - f['type'] = "'decimal'" f['precision'] = field['numeric_precision'] f['scale'] = field['numeric_scale'] or 0 + f['type'] = "'decimal({},{})'".format(f['precision'],f['scale']) elif field['data_type'] in ('bytea', ): f['type'] = "'blob'" elif field['data_type'] in ('point', 'lseg', 'polygon', 'unknown', 'USER-DEFINED'):