### ⚠️ This issue respects the following points: ⚠️
- [x] This is a **bug**, no…t a question or a configuration/webserver/proxy issue.
- [x] This issue is **not** already reported on Github _(I've searched it)_.
- [x] I agree to follow Nextcloud's [Code of Conduct](https://nextcloud.com/contribute/code-of-conduct/).
### What went wrong, what did you observe?
```
sudo -u www-data php /var/www/nextcloud/occ app:update --all
polls new version available: 9.0.2
Error: An exception occurred while executing a query: SQLSTATE[25P02]: In failed sql transaction: 7 ERROR: current transaction is aborted, commands ignored until end of transaction block
polls couldn't be updated
```
I then tried:
```
sudo -u www-data php /var/www/nextcloud/occ upgrade
Setting log level to debug
Turned on maintenance mode
Updating database schema
Updated database
Updating <polls> ...
Repair error: An exception occurred while executing a query: SQLSTATE[42P07]: Duplicate table: 7 ERROR: relation "uniq_preferences" already exists
Repair error: An exception occurred while executing a query: SQLSTATE[25P02]: In failed sql transaction: 7 ERROR: current transaction is aborted, commands ignored until end of transaction block
Repair error: An exception occurred while executing a query: SQLSTATE[25P02]: In failed sql transaction: 7 ERROR: current transaction is aborted, commands ignored until end of transaction block
OC\DB\Exceptions\DbalException: An exception occurred while executing a query: SQLSTATE[25P02]: In failed sql transaction: 7 ERROR: current transaction is aborted, commands ignored until end of transaction block
Update failed
Maintenance mode is kept active
Resetting log level
```
Then I tried removing the Polls app entirely to re-install it
```
sudo -u www-data php /var/www/nextcloud/occ app:remove polls
Nextcloud or one of the apps require upgrade - only a limited number of commands are available
You may use your browser or the occ upgrade command to do the upgrade
polls disabled
polls 9.0.2 removed
sudo -u www-data php /var/www/nextcloud/occ upgrade
No upgrade required.
Note: This command triggers the upgrade actions associated with a new version. The new version's updated source files must be deployed in advance.
See the upgrade documentation: https://docs.nextcloud.com/server/33/go.php?to=admin-update for more information.
```
I then tried to re-install the Polls app
```
sudo -u www-data php /var/www/nextcloud/occ app:install polls
Error: An exception occurred while executing a query: SQLSTATE[25P02]: In failed sql transaction: 7 ERROR: current transaction is aborted, commands ignored until end of transaction block
```
### What did you expect, how polls should behave instead?
I expected the upgrade went well.
### What steps does it need to replay this bug?
The steps is detailed in the "What went wrong".
1. Try to update the polls app
### Affected polls version
9.0.2
### Installation method
Installed/updated using occ
### Installation type
Updated from a minor version within same major version (i.e. 8.0.0 to 8.1.2)
### Can you rule out that any extension you use is involved in the issue?
- [x] I have checked all browser extension
### Which browser did you use, when experiencing the bug?
- [ ] Firefox
- [ ] Chrome
- [x] Chromium/Chromium based (i.e. Edge)
- [ ] Safari
- [ ] Other/Don't know
### Other browser
_No response_
### Add your browser log here
```json
```
### Additional client environment information
_No response_
### NC version
Nextcloud 33 (Hub 26 Winter)
### Other Nextcloud version
_No response_
### PHP engine version
PHP 8.4
### Other PHP version
_No response_
### Database engine
PostgreSQL
### Database Engine version or other Database
PostGreSQL 17.7
### Which user-backends are you using?
- [x] Default user-backend _(database)_
- [x] LDAP/ Active Directory
- [ ] SSO - SAML
- [ ] Other/Don't know
### Add your nextcloud server log here
```json
To many characters.
I will post one message, and then attach text file (or link to file):
"Message": "SQLSTATE[42P07]: Duplicate table: 7 ERROR: relation \"uniq_preferences\" already exists",
"message": "Exception while executing repair step Polls - Create all unique indices",
"exception": "{\"class\":\"OC\\DB\\Exceptions\\DbalException\",\"message\":\"An exception occurred while executing a query: SQLSTATE[42P07]: Duplicate table: 7 ERROR: relation \\\"uniq_preferences\\\" already exists\",\"code\":7,\"file\":\"/var/www/nextcloud/lib/private/DB/Exceptions/DbalException.php:56\",\"trace\":\"#0 /var/www/nextcloud/lib/private/DB/ConnectionAdapter.php(231): OC\\DB\\Exceptions\\DbalException::wrap()\\n#1 /var/www/nextcloud/apps/polls/lib/Migration/RepairSteps/CreateUniqueIndices.php(40): OC\\DB\\ConnectionAdapter->migrateToSchema()\\n#2 /var/www/nextcloud/lib/private/Repair.php(107): OCA\\Polls\\Migration\\RepairSteps\\CreateUniqueIndices->run()\\n#3 /var/www/nextcloud/lib/private/legacy/OC_App.php(543): OC\\Repair->run()\\n#4 /var/www/nextcloud/lib/private/App/AppManager.php(1075): OC_App::executeRepairSteps()\\n#5 /var/www/nextcloud/lib/private/Installer.php(111): OC\\App\\AppManager->upgradeApp()\\n#6 /var/www/nextcloud/core/Command/App/Update.php(99): OC\\Installer->updateAppstoreApp()\\n#7 /var/www/nextcloud/3rdparty/symfony/console/Command/Command.php(326): OC\\Core\\Command\\App\\Update->execute()\\n#8 /var/www/nextcloud/3rdparty/symfony/console/Application.php(1083): Symfony\\Component\\Console\\Command\\Command->run()\\n#9 /var/www/nextcloud/3rdparty/symfony/console/Application.php(324): Symfony\\Component\\Console\\Application->doRunCommand()\\n#10 /var/www/nextcloud/3rdparty/symfony/console/Application.php(175): Symfony\\Component\\Console\\Application->doRun()\\n#11 /var/www/nextcloud/lib/private/Console/Application.php(187): Symfony\\Component\\Console\\Application->run()\\n#12 /var/www/nextcloud/console.php(92): OC\\Console\\Application->run()\\n#13 /var/www/nextcloud/occ(33): require_once('...')\\n#14 {main}\",\"previous\":{\"class\":\"Doctrine\\DBAL\\Exception\\TableExistsException\",\"message\":\"An exception occurred while executing a query: SQLSTATE[42P07]: Duplicate table: 7 ERROR: relation \\\"uniq_preferences\\\" already exists\",\"code\":7,\"file\":\"/var/www/nextcloud/3rdparty/doctrine/dbal/src/Driver/API/PostgreSQL/ExceptionConverter.php:74\",\"trace\":\"#0 /var/www/nextcloud/3rdparty/doctrine/dbal/src/Connection.php(1976): Doctrine\\DBAL\\Driver\\API\\PostgreSQL\\ExceptionConverter->convert()\\n#1 /var/www/nextcloud/3rdparty/doctrine/dbal/src/Connection.php(1918): Doctrine\\DBAL\\Connection->handleDriverException()\\n#2 /var/www/nextcloud/3rdparty/doctrine/dbal/src/Connection.php(1218): Doctrine\\DBAL\\Connection->convertExceptionDuringQuery()\\n#3 /var/www/nextcloud/3rdparty/doctrine/dbal/src/Connections/PrimaryReadReplicaConnection.php(292): Doctrine\\DBAL\\Connection->executeStatement()\\n#4 /var/www/nextcloud/lib/private/DB/Connection.php(467): Doctrine\\DBAL\\Connections\\PrimaryReadReplicaConnection->executeStatement()\\n#5 /var/www/nextcloud/lib/private/DB/Migrator.php(142): OC\\DB\\Connection->executeStatement()\\n#6 /var/www/nextcloud/lib/private/DB/Migrator.php(47): OC\\DB\\Migrator->applySchema()\\n#7 /var/www/nextcloud/lib/private/DB/Connection.php(814): OC\\DB\\Migrator->migrate()\\n#8 /var/www/nextcloud/lib/private/DB/ConnectionAdapter.php(229): OC\\DB\\Connection->migrateToSchema()\\n#9 /var/www/nextcloud/apps/polls/lib/Migration/RepairSteps/CreateUniqueIndices.php(40): OC\\DB\\ConnectionAdapter->migrateToSchema()\\n#10 /var/www/nextcloud/lib/private/Repair.php(107): OCA\\Polls\\Migration\\RepairSteps\\CreateUniqueIndices->run()\\n#11 /var/www/nextcloud/lib/private/legacy/OC_App.php(543): OC\\Repair->run()\\n#12 /var/www/nextcloud/lib/private/App/AppManager.php(1075): OC_App::executeRepairSteps()\\n#13 /var/www/nextcloud/lib/private/Installer.php(111): OC\\App\\AppManager->upgradeApp()\\n#14 /var/www/nextcloud/core/Command/App/Update.php(99): OC\\Installer->updateAppstoreApp()\\n#15 /var/www/nextcloud/3rdparty/symfony/console/Command/Command.php(326): OC\\Core\\Command\\App\\Update->execute()\\n#16 /var/www/nextcloud/3rdparty/symfony/console/Application.php(1083): Symfony\\Component\\Console\\Command\\Command->run()\\n#17 /var/www/nextcloud/3rdparty/symfony/console/Application.php(324): Symfony\\Component\\Console\\Application->doRunCommand()\\n#18 /var/www/nextcloud/3rdparty/symfony/console/Application.php(175): Symfony\\Component\\Console\\Application->doRun()\\n#19 /var/www/nextcloud/lib/private/Console/Application.php(187): Symfony\\Component\\Console\\Application->run()\\n#20 /var/www/nextcloud/console.php(92): OC\\Console\\Application->run()\\n#21 /var/www/nextcloud/occ(33): require_once('...')\\n#22 {main}\",\"previous\":{\"class\":\"Doctrine\\DBAL\\Driver\\PDO\\Exception\",\"message\":\"SQLSTATE[42P07]: Duplicate table: 7 ERROR: relation \\\"uniq_preferences\\\" already exists\",\"code\":7,\"file\":\"/var/www/nextcloud/3rdparty/doctrine/dbal/src/Driver/PDO/Exception.php:24\",\"trace\":\"#0 /var/www/nextcloud/3rdparty/doctrine/dbal/src/Driver/PDO/Connection.php(39): Doctrine\\DBAL\\Driver\\PDO\\Exception::new()\\n#1 /var/www/nextcloud/3rdparty/doctrine/dbal/src/Connection.php(1216): Doctrine\\DBAL\\Driver\\PDO\\Connection->exec()\\n#2 /var/www/nextcloud/3rdparty/doctrine/dbal/src/Connections/PrimaryReadReplicaConnection.php(292): Doctrine\\DBAL\\Connection->executeStatement()\\n#3 /var/www/nextcloud/lib/private/DB/Connection.php(467): Doctrine\\DBAL\\Connections\\PrimaryReadReplicaConnection->executeStatement()\\n#4 /var/www/nextcloud/lib/private/DB/Migrator.php(142): OC\\DB\\Connection->executeStatement()\\n#5 /var/www/nextcloud/lib/private/DB/Migrator.php(47): OC\\DB\\Migrator->applySchema()\\n#6 /var/www/nextcloud/lib/private/DB/Connection.php(814): OC\\DB\\Migrator->migrate()\\n#7 /var/www/nextcloud/lib/private/DB/ConnectionAdapter.php(229): OC\\DB\\Connection->migrateToSchema()\\n#8 /var/www/nextcloud/apps/polls/lib/Migration/RepairSteps/CreateUniqueIndices.php(40): OC\\DB\\ConnectionAdapter->migrateToSchema()\\n#9 /var/www/nextcloud/lib/private/Repair.php(107): OCA\\Polls\\Migration\\RepairSteps\\CreateUniqueIndices->run()\\n#10 /var/www/nextcloud/lib/private/legacy/OC_App.php(543): OC\\Repair->run()\\n#11 /var/www/nextcloud/lib/private/App/AppManager.php(1075): OC_App::executeRepairSteps()\\n#12 /var/www/nextcloud/lib/private/Installer.php(111): OC\\App\\AppManager->upgradeApp()\\n#13 /var/www/nextcloud/core/Command/App/Update.php(99): OC\\Installer->updateAppstoreApp()\\n#14 /var/www/nextcloud/3rdparty/symfony/console/Command/Command.php(326): OC\\Core\\Command\\App\\Update->execute()\\n#15 /var/www/nextcloud/3rdparty/symfony/console/Application.php(1083): Symfony\\Component\\Console\\Command\\Command->run()\\n#16 /var/www/nextcloud/3rdparty/symfony/console/Application.php(324): Symfony\\Component\\Console\\Application->doRunCommand()\\n#17 /var/www/nextcloud/3rdparty/symfony/console/Application.php(175): Symfony\\Component\\Console\\Application->doRun()\\n#18 /var/www/nextcloud/lib/private/Console/Application.php(187): Symfony\\Component\\Console\\Application->run()\\n#19 /var/www/nextcloud/console.php(92): OC\\Console\\Application->run()\\n#20 /var/www/nextcloud/occ(33): require_once('...')\\n#21 {main}\",\"previous\":{\"class\":\"PDOException\",\"message\":\"SQLSTATE[42P07]: Duplicate table: 7 ERROR: relation \\\"uniq_preferences\\\" already exists\",\"code\":\"42P07\",\"file\":\"/var/www/nextcloud/3rdparty/doctrine/dbal/src/Driver/PDO/Connection.php:33\",\"trace\":\"#0 /var/www/nextcloud/3rdparty/doctrine/dbal/src/Driver/PDO/Connection.php(33): PDO->exec()\\n#1 /var/www/nextcloud/3rdparty/doctrine/dbal/src/Connection.php(1216): Doctrine\\DBAL\\Driver\\PDO\\Connection->exec()\\n#2 /var/www/nextcloud/3rdparty/doctrine/dbal/src/Connections/PrimaryReadReplicaConnection.php(292): Doctrine\\DBAL\\Connection->executeStatement()\\n#3 /var/www/nextcloud/lib/private/DB/Connection.php(467): Doctrine\\DBAL\\Connections\\PrimaryReadReplicaConnection->executeStatement()\\n#4 /var/www/nextcloud/lib/private/DB/Migrator.php(142): OC\\DB\\Connection->executeStatement()\\n#5 /var/www/nextcloud/lib/private/DB/Migrator.php(47): OC\\DB\\Migrator->applySchema()\\n#6 /var/www/nextcloud/lib/private/DB/Connection.php(814): OC\\DB\\Migrator->migrate()\\n#7 /var/www/nextcloud/lib/private/DB/ConnectionAdapter.php(229): OC\\DB\\Connection->migrateToSchema()\\n#8 /var/www/nextcloud/apps/polls/lib/Migration/RepairSteps/CreateUniqueIndices.php(40): OC\\DB\\ConnectionAdapter->migrateToSchema()\\n#9 /var/www/nextcloud/lib/private/Repair.php(107): OCA\\Polls\\Migration\\RepairSteps\\CreateUniqueIndices->run()\\n#10 /var/www/nextcloud/lib/private/legacy/OC_App.php(543): OC\\Repair->run()\\n#11 /var/www/nextcloud/lib/private/App/AppManager.php(1075): OC_App::executeRepairSteps()\\n#12 /var/www/nextcloud/lib/private/Installer.php(111): OC\\App\\AppManager->upgradeApp()\\n#13 /var/www/nextcloud/core/Command/App/Update.php(99): OC\\Installer->updateAppstoreApp()\\n#14 /var/www/nextcloud/3rdparty/symfony/console/Command/Command.php(326): OC\\Core\\Command\\App\\Update->execute()\\n#15 /var/www/nextcloud/3rdparty/symfony/console/Application.php(1083): Symfony\\Component\\Console\\Command\\Command->run()\\n#16 /var/www/nextcloud/3rdparty/symfony/console/Application.php(324): Symfony\\Component\\Console\\Application->doRunCommand()\\n#17 /var/www/nextcloud/3rdparty/symfony/console/Application.php(175): Symfony\\Component\\Console\\Application->doRun()\\n#18 /var/www/nextcloud/lib/private/Console/Application.php(187): Symfony\\Component\\Console\\Application->run()\\n#19 /var/www/nextcloud/console.php(92): OC\\Console\\Application->run()\\n#20 /var/www/nextcloud/occ(33): require_once('...')\\n#21 {main}\"}}}}",
"CustomMessage": "Exception while executing repair step Polls - Create all unique indices"
https://cloud.kerasit.dk/s/PollsBug
```
### Additional environment informations
_No response_
### Configuration report
```shell
{
"system": {
"instanceid": "***REMOVED SENSITIVE VALUE***",
"serverid": 0,
"datadirectory": "***REMOVED SENSITIVE VALUE***",
"version": "33.0.2.2",
"overwrite.cli.url": "https:\/\/cloud.kerasit.dk",
"htaccess.RewriteBase": "\/",
"overwriteprotocol": "https",
"installed": true,
"ldapProviderFactory": "OCA\\User_LDAP\\LDAPProviderFactory",
"data-fingerprint": "1ac6c1ca77e3ccc2941a65b9dbdd4021",
"default_phone_region": "DK",
"maintenance": false,
"twofactor_enforced": "false",
"twofactor_enforced_groups": [],
"twofactor_enforced_excluded_groups": [
"admin",
"NCNoMFA"
],
"share_folder": "\/Delinger",
"loglevel": 1,
"app_install_overwrite": {
"1": "cas",
"2": "otpmanager",
"3": "secrets",
"4": "cfg_share_links",
"6": "files_texteditor",
"7": "side_menu"
},
"theme": "",
"memories.exiftool": "\/var\/www\/nextcloud\/apps\/memories\/bin-ext\/exiftool-amd64-glibc",
"memories.vod.path": "\/var\/www\/nextcloud\/apps\/memories\/bin-ext\/go-vod-amd64",
"maintenance_window_start": 1,
"memories.db.triggers.fcu": true,
"allow_local_remote_servers": true,
"filelocking.enabled": true,
"memcache.local": "\\OC\\Memcache\\APCu",
"memcache.locking": "\\OC\\Memcache\\Redis",
"redis": {
"host": "***REMOVED SENSITIVE VALUE***",
"port": 0,
"timeout": 0
},
"dbtype": "pgsql",
"dbname": "***REMOVED SENSITIVE VALUE***",
"dbhost": "***REMOVED SENSITIVE VALUE***",
"dbport": "5432",
"dbtableprefix": "oc_",
"dbuser": "***REMOVED SENSITIVE VALUE***",
"dbpassword": "***REMOVED SENSITIVE VALUE***",
"trusted_domains": [
"cloud.kerasit.dk",
"127.0.0.1",
"10.1.203.119",
"localhost",
"www.kerasit.dk"
],
"mail_smtpmode": "smtp",
"mail_sendmailmode": "pipe",
"mail_from_address": "***REMOVED SENSITIVE VALUE***",
"mail_domain": "***REMOVED SENSITIVE VALUE***",
"mail_smtpstreamoptions": {
"ssl": {
"allow_self_signed": true,
"verify_peer": false,
"verify_peer_name": false
}
},
"mail_smtphost": "***REMOVED SENSITIVE VALUE***",
"mail_smtpport": "1025",
"mail_smtpauth": 1,
"mail_smtpname": "***REMOVED SENSITIVE VALUE***",
"mail_smtppassword": "***REMOVED SENSITIVE VALUE***",
"app.mail.verify-tls-peer": false,
"trusted_proxies": "***REMOVED SENSITIVE VALUE***",
"passwordsalt": "***REMOVED SENSITIVE VALUE***",
"secret": "***REMOVED SENSITIVE VALUE***",
"defaultapp": "dashboard",
"twofactor_enforced_excluded_groups=admin": "",
"allow_user_to_change_display_name": true
}
}
```
### List of activated Apps
```shell
Enabled:
- activity: 6.0.0
- admin_audit: 1.23.0
- admincockpit: 1.2.7
- announcementcenter: 7.3.0
- approval: 3.2.2
- approve_links: 1.4.0
- assistant: 3.3.0
- attendance: 1.37.1
- bruteforcesettings: 6.0.0
- calendar: 6.2.2
- circles: 33.0.0
- cloud_federation_api: 1.17.0
- collectives: 4.3.0
- comments: 1.23.0
- contacts: 8.4.4
- contactsinteraction: 1.14.1
- countdown: 1.1.27
- dashboard: 7.13.0
- dashlink: 1.2.1
- dav: 1.36.0
- drop_account: 3.0.0
- end_to_end_encryption: 2.1.0
- event_update_notification: 2.8.0
- external: 8.0.0
- externalportal: 2.1.0
- federatedfilesharing: 1.23.0
- federation: 1.23.0
- files: 2.5.0
- files_downloadlimit: 5.1.0
- files_external: 1.25.1
- files_pdfviewer: 6.0.0
- files_reminders: 1.6.0
- files_sharing: 1.25.2
- files_trashbin: 1.23.0
- files_versions: 1.26.0
- groupfolders: 21.0.7
- guests: 4.6.0
- htmlviewer: 33.0.0
- integration_openai: 4.3.1
- learning: 4.2.2
- logcleaner: 1.4.2
- lookup_server_connector: 1.21.0
- mail: 5.7.12
- memegen: 2.0.1
- news: 28.2.0
- nextcloud_announcements: 5.0.0
- notes: 5.0.0
- notifications: 6.0.0
- notify_push: 1.3.1
- oauth2: 1.21.0
- oidc: 1.16.5
- ownershiptransfer: 1.4.0
- password_policy: 5.0.0
- passwords: 2026.3.21
- photos: 6.0.0
- privacy: 5.0.0
- profile: 1.2.0
- provisioning_api: 1.23.0
- recommendations: 6.0.0
- related_resources: 4.0.0
- richdocuments: 10.1.2
- richdocumentscode: 25.4.904
- roll_dice_bot: 1.0.0
- secrets: 3.0.3
- serverinfo: 5.0.0
- settings: 1.16.0
- sharebymail: 1.23.0
- side_menu: 5.3.0
- sketch_picker: 2.4.0
- socialsharing_facebook: 4.1.0
- spreed: 23.0.3
- support: 5.0.0
- survey_client: 5.0.0
- suspicious_login: 11.0.0
- systemtags: 1.23.0
- tasks: 0.17.1
- text: 7.0.0
- text_templates: 1.4.0
- theming: 2.8.0
- twofactor_backupcodes: 1.22.0
- twofactor_nextcloud_notification: 7.0.0
- twofactor_totp: 15.0.0
- twofactor_webauthn: 2.6.0
- updatenotification: 1.23.0
- user_ldap: 1.24.0
- user_status: 1.13.0
- users_picker: 1.2.2
- viewer: 6.0.0
- weather_status: 1.13.0
- webhook_listeners: 1.5.0
- workflowengine: 2.15.0
Disabled:
- app_api: 33.0.0 (installed 33.0.0)
- appointments: 2.7.2 (installed 2.7.2)
- call_summary_bot: 3.3.0 (installed 3.3.0)
- cas: 0.2.16 (installed 0.2.16)
- cfg_share_links: 7.0.1 (installed 7.0.1)
- checksum: 2.1.1 (installed 2.1.1)
- deck: 1.17.1 (installed 1.17.1)
- dicomviewer: 2.3.2 (installed 2.3.2)
- encryption: 2.21.0
- files_accesscontrol: 4.0.0 (installed 4.0.0)
- files_automatedtagging: 4.0.0 (installed 4.0.0)
- files_notify_redis: 0.3.7 (installed 0.3.7)
- files_texteditor: 2.15.1 (installed 2.15.1)
- files_zip: 2.3.0 (installed 2.3.0)
- firstrunwizard: 6.0.0 (installed 2.16.0)
- flow_notifications: 4.0.0 (installed 4.0.0)
- forms: 5.2.7 (installed 5.2.7)
- holiday_calendars: 0.3.0 (installed 0.3.0)
- impersonate: 4.0.0 (installed 4.0.0)
- logreader: 6.0.0 (installed 3.0.0)
- otpmanager: 1.1.2 (installed 1.1.2)
- polls: 9.0.2 (installed 9.0.1)
- scim_client: 1.3.0 (installed 1.3.0)
- sharerenamer: 3.5.0 (installed 3.5.0)
- stepupauth: 0.2.3 (installed 0.2.3)
- testing: 1.23.0
- uppush: 2.4.0 (installed 2.4.0)
- user_saml: 8.0.0 (installed 8.0.0)
```
### Nextcloud Signing status
```shell
No errors have been found.
```
### Additional Information
_No response_