From: stronk7 Date: Sun, 20 Aug 2006 18:19:50 +0000 (+0000) Subject: Since PostgreSQL 7.4 the precision given for float columsn is X-Git-Url: http://git.mjollnir.org/gw?a=commitdiff_plain;h=f9543de627b93964dd8c4ef3a864e0e08ad64425;p=moodle.git Since PostgreSQL 7.4 the precision given for float columsn is the number of bits to use, and not the number of decimals. So, based on the number of decimals from the XMLDB schema, we are going to create REAL (<6 decimals) or DOUBLE PRECISION (>=6) columns. --- diff --git a/lib/xmldb/classes/generators/postgres7/postgres7.class.php b/lib/xmldb/classes/generators/postgres7/postgres7.class.php index 61f22b8a80..6a48e5461a 100644 --- a/lib/xmldb/classes/generators/postgres7/postgres7.class.php +++ b/lib/xmldb/classes/generators/postgres7/postgres7.class.php @@ -87,13 +87,11 @@ class XMLDBpostgres7 extends XMLDBgenerator { } break; case XMLDB_TYPE_FLOAT: - $dbtype = 'REAL'; - if (!empty($xmldb_length)) { - $dbtype .= '(' . $xmldb_length; - if (!empty($xmldb_decimals)) { - $dbtype .= ',' . $xmldb_decimals; + $dbtype = 'DOUBLE PRECISION'; + if (!empty($xmldb_decimals)) { + if ($xmldb_decimals < 6) { + $dbtype = 'REAL'; } - $dbtype .= ')'; } break; case XMLDB_TYPE_CHAR: