]> git.mjollnir.org Git - moodle.git/commitdiff
Since PostgreSQL 7.4 the precision given for float columsn is
authorstronk7 <stronk7>
Sun, 20 Aug 2006 18:19:50 +0000 (18:19 +0000)
committerstronk7 <stronk7>
Sun, 20 Aug 2006 18:19:50 +0000 (18:19 +0000)
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.

lib/xmldb/classes/generators/postgres7/postgres7.class.php

index 61f22b8a8039a28928d9744588f7d1703fc35805..6a48e5461a09b1937fcbe9e18b873d993144cf85 100644 (file)
@@ -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: