From: Nils Freydank Date: Sun, 10 Dec 2017 13:00:00 +0100 This is a patch provided by another nextcloud user on 5th November (yep, you read correctly). It fixes the NC upgrade running postgresql-10. I tested it for nextcloud 12.0.3 -> 12.0.4, but it might be needed for earlier releases, too. Original source: https://github.com/nextcloud/server/issues/5930#issuecomment-341978185 --- a/3rdparty/doctrine/dbal/lib/Doctrine/DBAL/Schema/PostgreSqlSchemaManager.php 2017-11-05 15:37:27.538064270 +0100 +++ b/3rdparty/doctrine/dbal/lib/Doctrine/DBAL/Schema/PostgreSqlSchemaManager.php 2017-11-05 15:38:54.014644323 +0100 @@ -289,7 +289,16 @@ $sequenceName = $sequence['relname']; } - $data = $this->_conn->fetchAll('SELECT min_value, increment_by FROM ' . $this->_platform->quoteIdentifier($sequenceName)); + $version = floatval($this->_conn->getWrappedConnection()->getServerVersion()); + + if ($version >= 10) { + $data = $this->_conn->fetchAll('SELECT min_value, increment_by FROM pg_sequences WHERE schemaname = \'public\' AND sequencename = '.$this->_conn->quote($sequenceName)); + } + else + { + $data = $this->_conn->fetchAll('SELECT min_value, increment_by FROM ' . $this->_platform->quoteIdentifier($sequenceName)); + } +// $data = $this->_conn->fetchAll('SELECT min_value, increment_by FROM ' . $this->_platform->quoteIdentifier($sequenceName)); return new Sequence($sequenceName, $data[0]['increment_by'], $data[0]['min_value']); }