Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Upgrade to 6.0.0 fails #6330

Closed
wolkenschieber opened this issue Dec 11, 2013 · 25 comments
Closed

Upgrade to 6.0.0 fails #6330

wolkenschieber opened this issue Dec 11, 2013 · 25 comments

Comments

@wolkenschieber
Copy link

Another update, another failure with postgres :-(

I just upgraded from 5.0.0.14 to 6.0.0. Maintance mode can't be left, because database schema upgrade doesn't finish.

Postgres.log:
ERROR: syntax error at end of input at character 60
STATEMENT: ALTER TABLE "oc_pictures_images_cache" ALTER uid_owner SET

owncloud.log:
{"app":"core","message":"Failed to update database structure (exception 'PDOException' with message 'SQLSTATE[42601]: Syntax error: 7 ERROR: synt
ax error at end of input\nLINE 1: ALTER TABLE "oc_pictures_images_cache" ALTER uid_owner SET \n
^' in /var/www/owncloud/3rdparty/doctrine/dbal/lib/Doctrine/DBAL/Connection.php:742\nStack trace:\n#0 [internal functi
on]: PDO->query('ALTER TABLE "oc...')\n#1 /var/www/owncloud/3rdparty/doctrine/dbal/lib/Doctrine/DBAL/Connection.php(742): call_user_func_array(Array, Array)\n#2 /var/www/owncloud/lib/private/db/mdb2schemamanager.php(152):

@karlitschek
Copy link
Contributor

duplicate of #6313

@wolkenschieber
Copy link
Author

A quick fix for me was to drop the tables oc_pictures_images_cache and oc_gallery_sharing.

@wolkenschieber
Copy link
Author

Table oc_pictures_images_cache from 5.0.0.14:
Table "public.oc_pictures_images_cache"
Column | Type | Modifiers | Storage | Description
-----------+------------------------+-----------------------------------------+----------+-------------
uid_owner | character varying(64) | not null default ' '::character varying | extended |
path | character varying(256) | not null default ' '::character varying | extended |
width | integer | not null default 0 | plain |
height | integer | not null default 0 | plain |

Same table is 6.0.0:
Table "public.oc_pictures_images_cache"
Column | Type | Modifiers | Storage | Description
-----------+------------------------+-----------+----------+-------------
uid_owner | character varying(64) | not null | extended |
path | character varying(256) | not null | extended |
width | integer | not null | plain |
height | integer | not null | plain |

There's obviously a bug in the database scheme upgrade process.

@MorrisJobke
Copy link
Contributor

@bartv2 Can you have a look?

@MorrisJobke MorrisJobke reopened this Dec 11, 2013
@MorrisJobke
Copy link
Contributor

The message looks like an incomplete SQL statement.
https://github.com/owncloud/apps/blob/master/gallery/appinfo/database.xml

@butonic
Copy link
Member

butonic commented Dec 11, 2013

could reproduce the issue with installing a stock OC5 on postgres, uploading a few files, ant then doing the migrate to OC6. Had defined DEBUG as true:

{"app":"index","message":"Exception: An exception occurred while executing 'SELECT \"id\" FROM \"oc_jobs\" WHERE \"class\" = ? AND \"argument\" = ?':\n\nSQLSTATE[42P01]: Undefined table: 7 FEHLER:  Relation \u201eoc_jobs\u201c existiert nicht\nLINE 1: SELECT \"id\" FROM \"oc_jobs\" WHERE \"class\" = $1 AND \"argument\"...\n                         ^","level":4,"time":"2013-12-11T22:34:52+00:00"}
{"app":"index","message":"Exception: 0 \/home\/jfd\/Repositories\/oc\/owncloud.dist.6.0.0\/3rdparty\/doctrine\/dbal\/lib\/Doctrine\/DBAL\/Statement.php(140): Doctrine\\DBAL\\DBALException::driverExceptionDuringQuery(Object(PDOException), 'SELECT \"id\" FRO...', Array)\n","level":4,"time":"2013-12-11T22:34:52+00:00"}
{"app":"index","message":"Exception: 1 \/home\/jfd\/Repositories\/oc\/owncloud.dist.6.0.0\/lib\/private\/db\/statementwrapper.php(70): Doctrine\\DBAL\\Statement->execute(Array)\n","level":4,"time":"2013-12-11T22:34:52+00:00"}
{"app":"index","message":"Exception: 2 \/home\/jfd\/Repositories\/oc\/owncloud.dist.6.0.0\/lib\/private\/backgroundjob\/joblist.php(71): OC_DB_StatementWrapper->execute(Array)\n","level":4,"time":"2013-12-11T22:34:52+00:00"}
{"app":"index","message":"Exception: 3 \/home\/jfd\/Repositories\/oc\/owncloud.dist.6.0.0\/lib\/private\/backgroundjob\/joblist.php(24): OC\\BackgroundJob\\JobList->has('OC\\BackgroundJo...', Array)\n","level":4,"time":"2013-12-11T22:34:52+00:00"}
{"app":"index","message":"Exception: 4 \/home\/jfd\/Repositories\/oc\/owncloud.dist.6.0.0\/lib\/public\/backgroundjob.php(75): OC\\BackgroundJob\\JobList->add('OC\\BackgroundJo...', Array)\n","level":4,"time":"2013-12-11T22:34:52+00:00"}
{"app":"index","message":"Exception: 5 \/home\/jfd\/Repositories\/oc\/owncloud.dist.6.0.0\/lib\/public\/backgroundjob.php(86): OCP\\BackgroundJob::registerJob('OC\\BackgroundJo...', Array)\n","level":4,"time":"2013-12-11T22:34:52+00:00"}
{"app":"index","message":"Exception: 6 \/home\/jfd\/Repositories\/oc\/owncloud.dist.6.0.0\/apps\/files\/appinfo\/app.php(22): OCP\\BackgroundJob::addRegularTask('\\OC\\Files\\Cache...', 'checkNext')\n","level":4,"time":"2013-12-11T22:34:52+00:00"}
{"app":"index","message":"Exception: 7 \/home\/jfd\/Repositories\/oc\/owncloud.dist.6.0.0\/lib\/private\/app.php(93): require_once('\/home\/jfd\/Repos...')\n","level":4,"time":"2013-12-11T22:34:52+00:00"}
{"app":"index","message":"Exception: 8 \/home\/jfd\/Repositories\/oc\/owncloud.dist.6.0.0\/lib\/private\/app.php(66): OC_App::loadApp('files')\n","level":4,"time":"2013-12-11T22:34:52+00:00"}
{"app":"index","message":"Exception: 9 \/home\/jfd\/Repositories\/oc\/owncloud.dist.6.0.0\/lib\/base.php(689): OC_App::loadApps()\n","level":4,"time":"2013-12-11T22:34:52+00:00"}
{"app":"index","message":"Exception: 10 \/home\/jfd\/Repositories\/oc\/owncloud.dist.6.0.0\/index.php(30): OC::handleRequest()\n","level":4,"time":"2013-12-11T22:34:52+00:00"}
{"app":"index","message":"Exception: 11 {main}","level":4,"time":"2013-12-11T22:34:52+00:00"}
{"app":"index","message":"Exception: An exception occurred while executing 'SELECT \"id\" FROM \"oc_jobs\" WHERE \"class\" = ? AND \"argument\" = ?':\n\nSQLSTATE[42P01]: Undefined table: 7 FEHLER:  Relation \u201eoc_jobs\u201c existiert nicht\nLINE 1: SELECT \"id\" FROM \"oc_jobs\" WHERE \"class\" = $1 AND \"argument\"...\n                         ^ - Verursacht durch: SQLSTATE[42P01]: Undefined table: 7 FEHLER:  Relation \u201eoc_jobs\u201c existiert nicht\nLINE 1: SELECT \"id\" FROM \"oc_jobs\" WHERE \"class\" = $1 AND \"argument\"...\n                         ^[42P01] ","level":4,"time":"2013-12-11T22:34:52+00:00"}
{"app":"core","message":"Failed to update database structure (exception 'PDOException' with message 'SQLSTATE[42601]: Syntax error: 7 FEHLER:  Syntaxfehler am Ende der Eingabe\nLINE 1: ALTER TABLE \"oc_properties\" ALTER propertyvalue SET \n                                                            ^' in \/home\/jfd\/Repositories\/oc\/owncloud.dist.6.0.0\/3rdparty\/doctrine\/dbal\/lib\/Doctrine\/DBAL\/Connection.php:742\nStack trace:\n#0 [internal function]: PDO->query('ALTER TABLE \"oc...')\n#1 \/home\/jfd\/Repositories\/oc\/owncloud.dist.6.0.0\/3rdparty\/doctrine\/dbal\/lib\/Doctrine\/DBAL\/Connection.php(742): call_user_func_array(Array, Array)\n#2 \/home\/jfd\/Repositories\/oc\/owncloud.dist.6.0.0\/lib\/private\/db\/mdb2schemamanager.php(152): Doctrine\\DBAL\\Connection->query('ALTER TABLE \"oc...')\n#3 \/home\/jfd\/Repositories\/oc\/owncloud.dist.6.0.0\/lib\/private\/db\/mdb2schemamanager.php(91): OC\\DB\\MDB2SchemaManager->executeSchemaChange(Object(Doctrine\\DBAL\\Schema\\SchemaDiff))\n#4 \/home\/jfd\/Repositories\/oc\/owncloud.dist.6.0.0\/lib\/private\/db.php(373): OC\\DB\\MDB2SchemaManager->updateDbFromStructure('\/home\/jfd\/Repos...')\n#5 \/home\/jfd\/Repositories\/oc\/owncloud.dist.6.0.0\/lib\/private\/updater.php(106): OC_DB::updateDbFromStructure('\/home\/jfd\/Repos...')\n#6 \/home\/jfd\/Repositories\/oc\/owncloud.dist.6.0.0\/core\/ajax\/update.php(34): OC\\Updater->upgrade()\n#7 {main}\n\nNext exception 'Doctrine\\DBAL\\DBALException' with message 'An exception occurred while executing 'ALTER TABLE \"oc_properties\" ALTER propertyvalue SET ':\n\nSQLSTATE[42601]: Syntax error: 7 FEHLER:  Syntaxfehler am Ende der Eingabe\nLINE 1: ALTER TABLE \"oc_properties\" ALTER propertyvalue SET \n                                                            ^' in \/home\/jfd\/Repositories\/oc\/owncloud.dist.6.0.0\/3rdparty\/doctrine\/dbal\/lib\/Doctrine\/DBAL\/DBALException.php:47\nStack trace:\n#0 \/home\/jfd\/Repositories\/oc\/owncloud.dist.6.0.0\/3rdparty\/doctrine\/dbal\/lib\/Doctrine\/DBAL\/Connection.php(744): Doctrine\\DBAL\\DBALException::driverExceptionDuringQuery(Object(PDOException), 'ALTER TABLE \"oc...')\n#1 \/home\/jfd\/Repositories\/oc\/owncloud.dist.6.0.0\/lib\/private\/db\/mdb2schemamanager.php(152): Doctrine\\DBAL\\Connection->query('ALTER TABLE \"oc...')\n#2 \/home\/jfd\/Repositories\/oc\/owncloud.dist.6.0.0\/lib\/private\/db\/mdb2schemamanager.php(91): OC\\DB\\MDB2SchemaManager->executeSchemaChange(Object(Doctrine\\DBAL\\Schema\\SchemaDiff))\n#3 \/home\/jfd\/Repositories\/oc\/owncloud.dist.6.0.0\/lib\/private\/db.php(373): OC\\DB\\MDB2SchemaManager->updateDbFromStructure('\/home\/jfd\/Repos...')\n#4 \/home\/jfd\/Repositories\/oc\/owncloud.dist.6.0.0\/lib\/private\/updater.php(106): OC_DB::updateDbFromStructure('\/home\/jfd\/Repos...')\n#5 \/home\/jfd\/Repositories\/oc\/owncloud.dist.6.0.0\/core\/ajax\/update.php(34): OC\\Updater->upgrade()\n#6 {main})","level":4,"time":"2013-12-11T22:34:52+00:00"}
{"app":"core","message":"App \"\" (user_migrate) can't be used because it is not compatible with this version of ownCloud","level":3,"time":"2013-12-11T22:34:52+00:00"}
{"app":"index","message":"Exception: An exception occurred while executing 'SELECT \"id\" FROM \"oc_jobs\" WHERE \"class\" = ? AND \"argument\" = ?':\n\nSQLSTATE[42P01]: Undefined table: 7 FEHLER:  Relation \u201eoc_jobs\u201c existiert nicht\nLINE 1: SELECT \"id\" FROM \"oc_jobs\" WHERE \"class\" = $1 AND \"argument\"...\n                         ^","level":4,"time":"2013-12-11T22:34:52+00:00"}
{"app":"index","message":"Exception: 0 \/home\/jfd\/Repositories\/oc\/owncloud.dist.6.0.0\/3rdparty\/doctrine\/dbal\/lib\/Doctrine\/DBAL\/Statement.php(140): Doctrine\\DBAL\\DBALException::driverExceptionDuringQuery(Object(PDOException), 'SELECT \"id\" FRO...', Array)\n","level":4,"time":"2013-12-11T22:34:52+00:00"}
{"app":"index","message":"Exception: 1 \/home\/jfd\/Repositories\/oc\/owncloud.dist.6.0.0\/lib\/private\/db\/statementwrapper.php(70): Doctrine\\DBAL\\Statement->execute(Array)\n","level":4,"time":"2013-12-11T22:34:52+00:00"}
{"app":"index","message":"Exception: 2 \/home\/jfd\/Repositories\/oc\/owncloud.dist.6.0.0\/lib\/private\/backgroundjob\/joblist.php(71): OC_DB_StatementWrapper->execute(Array)\n","level":4,"time":"2013-12-11T22:34:52+00:00"}
{"app":"index","message":"Exception: 3 \/home\/jfd\/Repositories\/oc\/owncloud.dist.6.0.0\/lib\/private\/backgroundjob\/joblist.php(24): OC\\BackgroundJob\\JobList->has('OC\\BackgroundJo...', Array)\n","level":4,"time":"2013-12-11T22:34:52+00:00"}
{"app":"index","message":"Exception: 4 \/home\/jfd\/Repositories\/oc\/owncloud.dist.6.0.0\/lib\/public\/backgroundjob.php(75): OC\\BackgroundJob\\JobList->add('OC\\BackgroundJo...', Array)\n","level":4,"time":"2013-12-11T22:34:52+00:00"}
{"app":"index","message":"Exception: 5 \/home\/jfd\/Repositories\/oc\/owncloud.dist.6.0.0\/lib\/public\/backgroundjob.php(86): OCP\\BackgroundJob::registerJob('OC\\BackgroundJo...', Array)\n","level":4,"time":"2013-12-11T22:34:52+00:00"}
{"app":"index","message":"Exception: 6 \/home\/jfd\/Repositories\/oc\/owncloud.dist.6.0.0\/apps\/files\/appinfo\/app.php(22): OCP\\BackgroundJob::addRegularTask('\\OC\\Files\\Cache...', 'checkNext')\n","level":4,"time":"2013-12-11T22:34:52+00:00"}
{"app":"index","message":"Exception: 7 \/home\/jfd\/Repositories\/oc\/owncloud.dist.6.0.0\/lib\/private\/app.php(93): require_once('\/home\/jfd\/Repos...')\n","level":4,"time":"2013-12-11T22:34:52+00:00"}
{"app":"index","message":"Exception: 8 \/home\/jfd\/Repositories\/oc\/owncloud.dist.6.0.0\/lib\/private\/app.php(66): OC_App::loadApp('files')\n","level":4,"time":"2013-12-11T22:34:52+00:00"}
{"app":"index","message":"Exception: 9 \/home\/jfd\/Repositories\/oc\/owncloud.dist.6.0.0\/lib\/base.php(689): OC_App::loadApps()\n","level":4,"time":"2013-12-11T22:34:52+00:00"}
{"app":"index","message":"Exception: 10 \/home\/jfd\/Repositories\/oc\/owncloud.dist.6.0.0\/index.php(30): OC::handleRequest()\n","level":4,"time":"2013-12-11T22:34:52+00:00"}
{"app":"index","message":"Exception: 11 {main}","level":4,"time":"2013-12-11T22:34:52+00:00"}
{"app":"index","message":"Exception: An exception occurred while executing 'SELECT \"id\" FROM \"oc_jobs\" WHERE \"class\" = ? AND \"argument\" = ?':\n\nSQLSTATE[42P01]: Undefined table: 7 FEHLER:  Relation \u201eoc_jobs\u201c existiert nicht\nLINE 1: SELECT \"id\" FROM \"oc_jobs\" WHERE \"class\" = $1 AND \"argument\"...\n                         ^ - Verursacht durch: SQLSTATE[42P01]: Undefined table: 7 FEHLER:  Relation \u201eoc_jobs\u201c existiert nicht\nLINE 1: SELECT \"id\" FROM \"oc_jobs\" WHERE \"class\" = $1 AND \"argument\"...\n                         ^[42P01] ","level":4,"time":"2013-12-11T22:34:52+00:00"}

now

{"app":"index","message":"Exception: An exception occurred while executing 'SELECT \"id\" FROM \"oc_jobs\" WHERE \"class\" = ? AND \"argument\" = ?':\n\nSQLSTATE[42P01]: Undefined table: 7 FEHLER:  Relation \u201eoc_jobs\u201c existiert nicht\nLINE 1: SELECT \"id\" FROM \"oc_jobs\" WHERE \"class\" = $1 AND \"argument\"...\n                         ^ - Verursacht durch: SQLSTATE[42P01]: Undefined table: 7 FEHLER:  Relation \u201eoc_jobs\u201c existiert nicht\nLINE 1: SELECT \"id\" FROM \"oc_jobs\" WHERE \"class\" = $1 AND \"argument\"...\n                         ^[42P01] ","level":4,"time":"2013-12-11T22:34:52+00:00"}

@bartv2 suspiciously looks like the backticks did not get replaced with the correct quotes ... \u203e is „ and \u201c is “ ... the correct quote is " the simple double quote ...

@butonic
Copy link
Member

butonic commented Dec 11, 2013

nevermind the quotes are just part of the error message ... so this is more related to oc_jobs really not being present...

@abompard
Copy link

@kabum is right, on PostgreSQL the generated upgrade SQL is ALTER TABLE "pictures_images_cache" ALTER width SET, which is obviously incomplete. This happens when a database column is set to NOT NULL without any DEFAULT. Then the getDefaultValueDeclarationSQL() method in 3rdparty/doctrine/dbal/lib/Doctrine/DBAL/Platforms/AbstractPlatform.php generates an empty string, which is just appended to the SQL command without checking.

@karlitschek
Copy link
Contributor

linking this here owncloud-archive/3rdparty#64 (comment)

@AceSlash
Copy link

Same issue on Debian 7.0 using the official repository with a postgresql database. upgrade just fail with the official 6.0 release.

@sven-ola
Copy link

Ah - fixed later. Sorry for bugging.

As a note to https://github.com/owncloud/apps/commit/74ca2bd8e0d85cae0c783031e036421f832b99ad and https://github.com/owncloud/apps/commit/0c6f6c52c16f85e28280e1621fb4d7a691c60d0c: you shure not having

$currentVersion=OC_Appconfig::getValue('search_lucene', 'installed_version');

is correct in preupdate.php?

@PVince81
Copy link
Contributor

I'm getting the oc_jobs error now when I upgrade from 5.0.13 to stable6, with SQLite (by checking out the corresponding tags in core, apps and 3rdparty)

@karlitschek
Copy link
Contributor

@butonic @DeepDiver1975 Any idea?

@PVince81
Copy link
Contributor

I think I'm onto something:

When the migration problem appeared for me, I had an older config.php with mysql DB settings but that I reset with installed: false and used sqlite. That caused the oc_jobs issue to appear.

Then, when I deleted the config.php and started from scratch, and only manually added the apps_path, then migration works fine.

@karlitschek
Copy link
Contributor

strange

@PVince81
Copy link
Contributor

My intuition tells me "table prefix". Need to verify this. Because it's probably the only extra DB setting that is used for SQLite.

@PVince81
Copy link
Contributor

Hmm, just saw that this bug was marked as duplicate of #6294 but by rereading the first post, it seems to be related to pictures table. I'll switch over to that other bug that more explicitly states my issue.
Feel free to follow me there 😉

@brot
Copy link

brot commented Dec 18, 2013

Is there any progress on this issue? Is there a workaround for the postrgres users? As far as I saw this problem also occured with the RC versions? Is there a fix now for the stable release?

@PVince81
Copy link
Contributor

@brot I'm not sure but you can try upgrading from 5.0.13 to 6.0.0a (not 6.0.0)
6.0.0a contains many fixes related to migration (to which this ticket might be a side effect)

@brot
Copy link

brot commented Dec 18, 2013

@PVince81 and where do I find the 6.0.0a download file?

@PVince81
Copy link
Contributor

Here: http://owncloud.org/install/
Click on "Tar or Zip file" then "Unix"

@dsu-igeek
Copy link

This patch allowed me to get through the upgrade. Not sure if the database is in the correct state but it seems to work. This just skips the ALTER TABLE when the default value is blank.

--- a/doctrine/dbal/lib/Doctrine/DBAL/Platforms/PostgreSqlPlatform.php
+++ b/doctrine/dbal/lib/Doctrine/DBAL/Platforms/PostgreSqlPlatform.php
@@ -378,7 +378,7 @@ class PostgreSqlPlatform extends AbstractPlatform
$sql[] = 'ALTER TABLE ' . $diff->name . ' ' . $query;
}

  •        if ($columnDiff->hasChanged('default')) {
    
  •        if ($columnDiff->hasChanged('default') && strlen($this->getDefaultValueDeclarationSQL($column->toArray())) > 0) {
             $query = 'ALTER ' . $oldColumnName . ' SET ' . $this->getDefaultValueDeclarationSQL($column->toArray());
             $sql[] = 'ALTER TABLE ' . $diff->name . ' ' . $query;
    

@PVince81
Copy link
Contributor

PVince81 commented Jan 7, 2014

Not sure but could be related: owncloud-archive/3rdparty#65 (comment)

@PVince81
Copy link
Contributor

PVince81 commented Feb 6, 2014

Any update ? Did you have any success upgrading to 6.0.1 with Postgres ?

@brot
Copy link

brot commented Feb 6, 2014

For me the version 6.0.1 worked. Thanks

@lock lock bot locked as resolved and limited conversation to collaborators Aug 19, 2019
Sign up for free to subscribe to this conversation on GitHub. Already have an account? Sign in.
Projects
None yet
Development

No branches or pull requests

10 participants