]> source.dussan.org Git - nextcloud-server.git/commitdiff
fix database upgrading for pgsql
authorRobin Appelman <icewind@owncloud.com>
Mon, 16 Jan 2012 01:06:19 +0000 (02:06 +0100)
committerRobin Appelman <icewind@owncloud.com>
Mon, 16 Jan 2012 01:06:19 +0000 (02:06 +0100)
3rdparty/MDB2/Driver/Manager/pgsql.php
lib/db.php

index a61821ef0538864a03ea30ab332fbe8cd5e23e7b..c99dd08e8ef34de7eeb7e5935433ae97b1e521f9 100644 (file)
@@ -396,6 +396,9 @@ class MDB2_Driver_Manager_pgsql extends MDB2_Driver_Manager_Common
                     }
                     $db->loadModule('Datatype', null, true);
                     $type = $db->datatype->getTypeDeclaration($field['definition']);
+                    if($type=='SERIAL PRIMARY KEY'){//not correct when altering a table
+                                               $type='integer';//use this instead
+                    }
                     $query = "ALTER $field_name TYPE $type USING CAST($field_name AS $type)";
                     $result = $db->exec("ALTER TABLE $name $query");
                     if (PEAR::isError($result)) {
@@ -692,7 +695,7 @@ class MDB2_Driver_Manager_pgsql extends MDB2_Driver_Manager_Common
             $table = $db->quoteIdentifier($schema, true) . '.' .$table;
         }
         $db->setLimit(1);
-        $result2 = $db->query("SELECT * FROM $table");
+        $result2 = $db->query("SELECT * FROM $table LIMIT 1");
         if (PEAR::isError($result2)) {
             return $result2;
         }
index 1a5f9874bd5ad282a499df21d3817612d7aa4607..4860651b323a41f05d7ce299f266b736efb44676 100644 (file)
@@ -144,7 +144,7 @@ class OC_DB {
 
                        // Prepare options array
                        $options = array(
-                         'portability' => MDB2_PORTABILITY_ALL,
+                         'portability' => MDB2_PORTABILITY_ALL & (!MDB2_PORTABILITY_FIX_CASE),
                          'log_line_break' => '<br>',
                          'idxname_format' => '%s',
                          'debug' => true,