Error with talk in new installation

Nextcloud version (eg, 24.0.1): 27
Talk Server version (eg, 14.0.2): replace me
Custom Signaling server configured: yes/no and version
Custom TURN server configured: yes/no
Custom STUN server configured: yes/no

In case the web version of Nextcloud Talk is involved:
Operating system (eg, Windows/Ubuntu/…): replace me
Browser name and version (eg, Chrome v101): replace me

In case mobile Nextcloud Talk apps are involved:
Talk iOS version (eg, 14.0.2): replace me
Talk Android version (eg, 14.0.2): replace me

The issue you are facing:

Is this the first time you’ve seen this error? (Y/N): Y

Steps to replicate it:

  1. Install a new Nextcloud AIO
  2. use ubuntu 22.04

The output of your Nextcloud log in Admin > Logging or errors in nextcloud.log in /var/www/:

[settings] Error: Doctrine\DBAL\Exception\TableExistsException: An exception occurred while executing a query: SQLSTATE[42P07]: Duplicate table: 7 ERROR:  relation "ts_session" already exists at <<closure>>

 0. /var/www/html/3rdparty/doctrine/dbal/src/Connection.php line 1814
    Doctrine\DBAL\Driver\API\PostgreSQL\ExceptionConverter->convert(["Doctrine\\DBAL ... "], ["Doctrine\\DBAL\\Query"])
 1. /var/www/html/3rdparty/doctrine/dbal/src/Connection.php line 1749
    Doctrine\DBAL\Connection->handleDriverException(["Doctrine\\DBAL ... "], ["Doctrine\\DBAL\\Query"])
 2. /var/www/html/3rdparty/doctrine/dbal/src/Connection.php line 1055
    Doctrine\DBAL\Connection->convertExceptionDuringQuery(["Doctrine\\DBAL ... "], "CREATE UNIQUE I ... )", [], [])
 3. /var/www/html/lib/private/DB/Connection.php line 262
    Doctrine\DBAL\Connection->executeQuery("CREATE UNIQUE I ... )", [], [], null)
 4. /var/www/html/3rdparty/doctrine/dbal/src/Connection.php line 1843
    OC\DB\Connection->executeQuery("CREATE UNIQUE I ... )")
 5. /var/www/html/lib/private/DB/Migrator.php line 162
    Doctrine\DBAL\Connection->query("CREATE UNIQUE I ... )")
 6. /var/www/html/lib/private/DB/Migrator.php line 68
    OC\DB\Migrator->applySchema(["Doctrine\\DBAL\\Schema\\Schema"])
 7. /var/www/html/lib/private/DB/Connection.php line 589
    OC\DB\Migrator->migrate(["Doctrine\\DBAL\\Schema\\Schema"])
 8. /var/www/html/lib/private/DB/MigrationService.php line 455
    OC\DB\Connection->migrateToSchema(["Doctrine\\DBAL\\Schema\\Schema"])
 9. /var/www/html/lib/private/DB/MigrationService.php line 409
    OC\DB\MigrationService->migrateSchemaOnly("latest")
10. /var/www/html/lib/private/Installer.php line 153
    OC\DB\MigrationService->migrate("latest", true)
11. /var/www/html/apps/settings/lib/Controller/AppSettingsController.php line 451
    OC\Installer->installApp("spreed")
12. /var/www/html/lib/private/AppFramework/Http/Dispatcher.php line 230
    OCA\Settings\Controller\AppSettingsController->enableApps(["spreed"], [])
13. /var/www/html/lib/private/AppFramework/Http/Dispatcher.php line 137
    OC\AppFramework\Http\Dispatcher->executeController(["OCA\\Settings\ ... "], "enableApps")
14. /var/www/html/lib/private/AppFramework/App.php line 183
    OC\AppFramework\Http\Dispatcher->dispatch(["OCA\\Settings\ ... "], "enableApps")
15. /var/www/html/lib/private/Route/Router.php line 315
    OC\AppFramework\App::main("OCA\\Settings\\ ... r", "enableApps", ["OC\\AppFramewo ... "], ["settings.AppSettings.enableApps"])
16. /var/www/html/lib/base.php line 1066
    OC\Route\Router->match("/settings/apps/enable")
17. /var/www/html/index.php line 36
    OC::handleRequest()

Caused by:

Doctrine\DBAL\Driver\PDO\Exception: SQLSTATE[42P07]: Duplicate table: 7 ERROR:  relation "ts_session" already exists at <<closure>>

 0. /var/www/html/3rdparty/doctrine/dbal/src/Driver/PDO/Connection.php line 77
    Doctrine\DBAL\Driver\PDO\Exception::new(["PDOException", ... ]])
 1. /var/www/html/3rdparty/doctrine/dbal/src/Connection.php line 1050
    Doctrine\DBAL\Driver\PDO\Connection->query("CREATE UNIQUE I ... )")
 2. /var/www/html/lib/private/DB/Connection.php line 262
    Doctrine\DBAL\Connection->executeQuery("CREATE UNIQUE I ... )", [], [], null)
 3. /var/www/html/3rdparty/doctrine/dbal/src/Connection.php line 1843
    OC\DB\Connection->executeQuery("CREATE UNIQUE I ... )")
 4. /var/www/html/lib/private/DB/Migrator.php line 162
    Doctrine\DBAL\Connection->query("CREATE UNIQUE I ... )")
 5. /var/www/html/lib/private/DB/Migrator.php line 68
    OC\DB\Migrator->applySchema(["Doctrine\\DBAL\\Schema\\Schema"])
 6. /var/www/html/lib/private/DB/Connection.php line 589
    OC\DB\Migrator->migrate(["Doctrine\\DBAL\\Schema\\Schema"])
 7. /var/www/html/lib/private/DB/MigrationService.php line 455
    OC\DB\Connection->migrateToSchema(["Doctrine\\DBAL\\Schema\\Schema"])
 8. /var/www/html/lib/private/DB/MigrationService.php line 409
    OC\DB\MigrationService->migrateSchemaOnly("latest")
 9. /var/www/html/lib/private/Installer.php line 153
    OC\DB\MigrationService->migrate("latest", true)
10. /var/www/html/apps/settings/lib/Controller/AppSettingsController.php line 451
    OC\Installer->installApp("spreed")
11. /var/www/html/lib/private/AppFramework/Http/Dispatcher.php line 230
    OCA\Settings\Controller\AppSettingsController->enableApps(["spreed"], [])
12. /var/www/html/lib/private/AppFramework/Http/Dispatcher.php line 137
    OC\AppFramework\Http\Dispatcher->executeController(["OCA\\Settings\ ... "], "enableApps")
13. /var/www/html/lib/private/AppFramework/App.php line 183
    OC\AppFramework\Http\Dispatcher->dispatch(["OCA\\Settings\ ... "], "enableApps")
14. /var/www/html/lib/private/Route/Router.php line 315
    OC\AppFramework\App::main("OCA\\Settings\\ ... r", "enableApps", ["OC\\AppFramewo ... "], ["settings.AppSettings.enableApps"])
15. /var/www/html/lib/base.php line 1066
    OC\Route\Router->match("/settings/apps/enable")
16. /var/www/html/index.php line 36
    OC::handleRequest()

Caused by:

PDOException: SQLSTATE[42P07]: Duplicate table: 7 ERROR:  relation "ts_session" already exists at <<closure>>

 0. /var/www/html/3rdparty/doctrine/dbal/src/Driver/PDO/Connection.php line 72
    PDO->query("CREATE UNIQUE I ... )")
 1. /var/www/html/3rdparty/doctrine/dbal/src/Connection.php line 1050
    Doctrine\DBAL\Driver\PDO\Connection->query("CREATE UNIQUE I ... )")
 2. /var/www/html/lib/private/DB/Connection.php line 262
    Doctrine\DBAL\Connection->executeQuery("CREATE UNIQUE I ... )", [], [], null)
 3. /var/www/html/3rdparty/doctrine/dbal/src/Connection.php line 1843
    OC\DB\Connection->executeQuery("CREATE UNIQUE I ... )")
 4. /var/www/html/lib/private/DB/Migrator.php line 162
    Doctrine\DBAL\Connection->query("CREATE UNIQUE I ... )")
 5. /var/www/html/lib/private/DB/Migrator.php line 68
    OC\DB\Migrator->applySchema(["Doctrine\\DBAL\\Schema\\Schema"])
 6. /var/www/html/lib/private/DB/Connection.php line 589
    OC\DB\Migrator->migrate(["Doctrine\\DBAL\\Schema\\Schema"])
 7. /var/www/html/lib/private/DB/MigrationService.php line 455
    OC\DB\Connection->migrateToSchema(["Doctrine\\DBAL\\Schema\\Schema"])
 8. /var/www/html/lib/private/DB/MigrationService.php line 409
    OC\DB\MigrationService->migrateSchemaOnly("latest")
 9. /var/www/html/lib/private/Installer.php line 153
    OC\DB\MigrationService->migrate("latest", true)
10. /var/www/html/apps/settings/lib/Controller/AppSettingsController.php line 451
    OC\Installer->installApp("spreed")
11. /var/www/html/lib/private/AppFramework/Http/Dispatcher.php line 230
    OCA\Settings\Controller\AppSettingsController->enableApps(["spreed"], [])
12. /var/www/html/lib/private/AppFramework/Http/Dispatcher.php line 137
    OC\AppFramework\Http\Dispatcher->executeController(["OCA\\Settings\ ... "], "enableApps")
13. /var/www/html/lib/private/AppFramework/App.php line 183
    OC\AppFramework\Http\Dispatcher->dispatch(["OCA\\Settings\ ... "], "enableApps")
14. /var/www/html/lib/private/Route/Router.php line 315
    OC\AppFramework\App::main("OCA\\Settings\\ ... r", "enableApps", ["OC\\AppFramewo ... "], ["settings.AppSettings.enableApps"])
15. /var/www/html/lib/base.php line 1066
    OC\Route\Router->match("/settings/apps/enable")
16. /var/www/html/index.php line 36
    OC::handleRequest()

POST /settings/apps/enable
from 203.134.211.196 by admin at 2023-07-18T17:21:12+00:00

The output of your Apache/nginx/system log in /var/log/____:

PASTE HERE

Your browser log if relevant (javascript console log, network log, etc.):

PASTE HERE
1 Like

same error message “An exception occurred while executing a query: SQLSTATE[42P07]: Duplicate table: 7 ERROR: relation “ts_session” already exists” with nextcloud aio docker version. nextcloud 27

UPDATE:
works fine with nextcloud 26
works fine if you upgrade to nextcloud 27 manually following

(I had to follow the procedure twice as mentioned in the post )
Checking https://yourhost/settings/admin/overview tells to run
php occ db:add-missing-indices
running it makes the error appear again
I had to delete the ts_session index manually in the oc_talk_sessions table
then “php occ db:add-missing-indices” completes without errors
I then recreated the index again manually changing the name to ts_session2 with :

CREATE UNIQUE INDEX “ts_session2” ON “public”.“oc_talk_sessions” USING btree (
“session_id” COLLATE “pg_catalog”.“default” “pg_catalog”.“text_ops” ASC NULLS LAST
);

1 Like

That’s really interesting and I am wondering if another app tries to create a index with the same name. Would any of you be able to provide a list of indices in the database? See for example PostgreSQL List Indexes

Yes, Text app since the upcoming release:

Right, and that one also uses the new event which is triggered by add-missing-indices…

fix(postgres): Use a unique index name by nickvergessen · Pull Request #4553 · nextcloud/text · GitHub should help

2 Likes