[Bug]: Unable to enable `user_ldap` app - PostgreSQL error: index "primary" does not exist
Nobody has claimed this yet.
- Dominant language
- PHP
- Stars
- 36.9k
- Forks
- 5.2k
- Avg merge
- 2d 3h
- Merged PRs (30d)
- 713
Description
⚠️ This issue respects the following points: ⚠️
- This is a bug, not a question or a configuration/webserver/proxy issue.
- This issue is not already reported on Github (I've searched it).
- Nextcloud Server is up to date. See Maintenance and Release Schedule for supported versions.
- Nextcloud Server is running on 64bit capable CPU, PHP and OS.
- I agree to follow Nextcloud's Code of Conduct.
Bug description
I'm unable to enable the user_ldap app, resulting with the following error :
An exception occurred while executing a query: SQLSTATE[42704]: Undefined object: 7 ERROR: index "primary" does not exist
Steps to reproduce
- ./occ app:enable user_ldap
- Get the error
Expected behavior
The app should enable.
Installation method
Community Manual installation with Archive
Operating system
Other
PHP engine version
PHP 8.1
Web server
Nginx
Database engine version
PostgreSQL
Is this bug present after an update or on a fresh install?
None
Are you using the Nextcloud Server Encryption module?
Encryption is Disabled
What user-backends are you using?
- Default user-backend (database)
- LDAP/ Active Directory
- SSO - SAML
- Other
Configuration report
{
"system": {
"instanceid": "***REMOVED SENSITIVE VALUE***",
"passwordsalt": "***REMOVED SENSITIVE VALUE***",
"secret": "***REMOVED SENSITIVE VALUE***",
"trusted_domains": [
"***REMOVED SENSITIVE VALUE***"
],
"datadirectory": "***REMOVED SENSITIVE VALUE***",
"overwrite.cli.url": "***REMOVED SENSITIVE VALUE***",
"dbtype": "pgsql",
"version": "25.0.4.1",
"dbname": "***REMOVED SENSITIVE VALUE***",
"dbhost": "***REMOVED SENSITIVE VALUE***",
"dbport": "",
"dbtableprefix": "oc_",
"mysql.utf8mb4": true,
"dbuser": "***REMOVED SENSITIVE VALUE***",
"installed": true,
"maintenance": false,
"theme": "",
"loglevel": 2,
"memcache.local": "\\OC\\Memcache\\APCu",
"memcache.locking": "\\OC\\Memcache\\Redis",
"redis": {
"host": "***REMOVED SENSITIVE VALUE***",
"port": 6379
},
"debug": "false",
"updater.release.channel": "stable",
"app_install_overwrite": [
"ocsms",
"sensorlogger",
"contacts",
"unsplash"
],
"encryption.key_storage_migrated": false,
"default_phone_region": "FR",
"filesystem_check_changes": 1,
"mail_smtpmode": "smtp",
"mail_smtpauthtype": "PLAIN",
"mail_sendmailmode": "smtp",
"mail_smtpauth": 1,
"mail_smtphost": "***REMOVED SENSITIVE VALUE***",
"mail_smtpport": "465",
"mail_smtpsecure": "ssl",
"mail_from_address": "***REMOVED SENSITIVE VALUE***",
"mail_domain": "***REMOVED SENSITIVE VALUE***",
"mail_smtpname": "***REMOVED SENSITIVE VALUE***",
"mail_smtppassword": "***REMOVED SENSITIVE VALUE***",
"updater.secret": "***REMOVED SENSITIVE VALUE***"
}
}
List of activated Apps
Enabled:
- activity: 2.17.0
- admin_audit: 1.15.0
- audioplayer: 3.3.1
- calendar: 4.2.4
- circles: 25.0.0
- cloud_federation_api: 1.8.0
- comments: 1.15.0
- contacts: 5.1.0
- contactsinteraction: 1.6.0
- dashboard: 7.5.0
- dav: 1.24.0
- encryption: 2.13.0
- federatedfilesharing: 1.15.0
- files: 1.20.1
- files_external: 1.17.0
- files_pdfviewer: 2.6.0
- files_rightclick: 1.4.0
- files_sharing: 1.17.0
- files_trashbin: 1.15.0
- logreader: 2.10.0
- lookup_server_connector: 1.13.0
- maps: 0.2.4
- nextcloud_announcements: 1.14.0
- notes: 4.6.0
- notifications: 2.13.1
- oauth2: 1.13.0
- ocsms: 2.2.0
- password_policy: 1.15.0
- photos: 2.0.1
- privacy: 1.9.0
- provisioning_api: 1.15.0
- recommendations: 1.4.0
- related_resources: 1.0.4
- serverinfo: 1.15.0
- settings: 1.7.0
- support: 1.8.0
- systemtags: 1.15.0
- text: 3.6.0
- theming: 2.0.1
- twofactor_backupcodes: 1.14.0
- twofactor_totp: 7.0.0
- updatenotification: 1.15.0
- user_status: 1.5.0
- viewer: 1.9.0
- weather_status: 1.5.0
- workflowengine: 2.7.0
Disabled:
- bruteforcesettings: 2.3.0
- federation: 1.3.0
- files_versions: 1.16.0
- firstrunwizard: 2.2.1
- gpxedit: 0.0.14
- gpxpod: 5.0.4
- keeweb: 0.6.10
- sharebymail: 1.3.0
- survey_client: 1.1.0
- suspicious_login
- user_ldap
Nextcloud Signing status
No errors have been found.
Nextcloud Logs
{"reqId":"HnUMISJJgQ7P51ipL9jy","level":3,"time":"2023-02-25T16:19:22+00:00","remoteAddr":"REDACTED","user":"skid","app":"settings","method":"POST","url":"/settings/apps/enable","message":"could not enable apps","userAgent":"Mozilla/5.0 (X11; Linux x86_64; rv:109.0) Gecko/20100101 Firefox/110.0","version":"25.0.4.1","exception":{"Exception":"Doctrine\\DBAL\\Exception\\DriverException","Message":"An exception occurred while executing a query: SQLSTATE[42704]: Undefined object: 7 ERROR: index \"primary\" does not exist","Code":7,"Trace":[{"file":"/usr/home/nextcloud/live/3rdparty/doctrine/dbal/src/Connection.php","line":1780,"function":"convert","class":"Doctrine\\DBAL\\Driver\\API\\PostgreSQL\\ExceptionConverter","type":"->"},{"file":"/usr/home/nextcloud/live/3rdparty/doctrine/dbal/src/Connection.php","line":1719,"function":"handleDriverException","class":"Doctrine\\DBAL\\Connection","type":"->"},{"file":"/usr/home/nextcloud/live/3rdparty/doctrine/dbal/src/Connection.php","line":1067,"function":"convertExceptionDuringQuery","class":"Doctrine\\DBAL\\Connection","type":"->"},{"file":"/usr/home/nextcloud/live/lib/private/DB/Connection.php","line":261,"function":"executeQuery","class":"Doctrine\\DBAL\\Connection","type":"->"},{"file":"/usr/home/nextcloud/live/3rdparty/doctrine/dbal/src/Connection.php","line":1809,"function":"executeQuery","class":"OC\\DB\\Connection","type":"->"},{"file":"/usr/home/nextcloud/live/lib/private/DB/Migrator.php","line":162,"function":"query","class":"Doctrine\\DBAL\\Connection","type":"->"},{"file":"/usr/home/nextcloud/live/lib/private/DB/Migrator.php","line":69,"function":"applySchema","class":"OC\\DB\\Migrator","type":"->"},{"file":"/usr/home/nextcloud/live/lib/private/DB/Connection.php","line":582,"function":"migrate","class":"OC\\DB\\Migrator","type":"->"},{"file":"/usr/home/nextcloud/live/lib/private/DB/MigrationService.php","line":454,"function":"migrateToSchema","class":"OC\\DB\\Connection","type":"->"},{"file":"/usr/home/nextcloud/live/lib/private/DB/MigrationService.php","line":408,"function":"migrateSchemaOnly","class":"OC\\DB\\MigrationService","type":"->"},{"file":"/usr/home/nextcloud/live/lib/private/Installer.php","line":153,"function":"migrate","class":"OC\\DB\\MigrationService","type":"->"},{"file":"/usr/home/nextcloud/live/apps/settings/lib/Controller/AppSettingsController.php","line":451,"function":"installApp","class":"OC\\Installer","type":"->"},{"file":"/usr/home/nextcloud/live/lib/private/AppFramework/Http/Dispatcher.php","line":225,"function":"enableApps","class":"OCA\\Settings\\Controller\\AppSettingsController","type":"->"},{"file":"/usr/home/nextcloud/live/lib/private/AppFramework/Http/Dispatcher.php","line":133,"function":"executeController","class":"OC\\AppFramework\\Http\\Dispatcher","type":"->"},{"file":"/usr/home/nextcloud/live/lib/private/AppFramework/App.php","line":172,"function":"dispatch","class":"OC\\AppFramework\\Http\\Dispatcher","type":"->"},{"file":"/usr/home/nextcloud/live/lib/private/Route/Router.php","line":298,"function":"main","class":"OC\\AppFramework\\App","type":"::"},{"file":"/usr/home/nextcloud/live/lib/base.php","line":1047,"function":"match","class":"OC\\Route\\Router","type":"->"},{"file":"/usr/home/nextcloud/live/index.php","line":36,"function":"handleRequest","class":"OC","type":"::"}],"File":"/usr/home/nextcloud/live/3rdparty/doctrine/dbal/src/Driver/API/PostgreSQL/ExceptionConverter.php","Line":83,"Previous":{"Exception":"Doctrine\\DBAL\\Driver\\PDO\\Exception","Message":"SQLSTATE[42704]: Undefined object: 7 ERROR: index \"primary\" does not exist","Code":7,"Trace":[{"file":"/usr/home/nextcloud/live/3rdparty/doctrine/dbal/src/Driver/PDO/Connection.php","line":87,"function":"new","class":"Doctrine\\DBAL\\Driver\\PDO\\Exception","type":"::"},{"file":"/usr/home/nextcloud/live/3rdparty/doctrine/dbal/src/Connection.php","line":1062,"function":"query","class":"Doctrine\\DBAL\\Driver\\PDO\\Connection","type":"->"},{"file":"/usr/home/nextcloud/live/lib/private/DB/Connection.php","line":261,"function":"executeQuery","class":"Doctrine\\DBAL\\Connection","type":"->"},{"file":"/usr/home/nextcloud/live/3rdparty/doctrine/dbal/src/Connection.php","line":1809,"function":"executeQuery","class":"OC\\DB\\Connection","type":"->"},{"file":"/usr/home/nextcloud/live/lib/private/DB/Migrator.php","line":162,"function":"query","class":"Doctrine\\DBAL\\Connection","type":"->"},{"file":"/usr/home/nextcloud/live/lib/private/DB/Migrator.php","line":69,"function":"applySchema","class":"OC\\DB\\Migrator","type":"->"},{"file":"/usr/home/nextcloud/live/lib/private/DB/Connection.php","line":582,"function":"migrate","class":"OC\\DB\\Migrator","type":"->"},{"file":"/usr/home/nextcloud/live/lib/private/DB/MigrationService.php","line":454,"function":"migrateToSchema","class":"OC\\DB\\Connection","type":"->"},{"file":"/usr/home/nextcloud/live/lib/private/DB/MigrationService.php","line":408,"function":"migrateSchemaOnly","class":"OC\\DB\\MigrationService","type":"->"},{"file":"/usr/home/nextcloud/live/lib/private/Installer.php","line":153,"function":"migrate","class":"OC\\DB\\MigrationService","type":"->"},{"file":"/usr/home/nextcloud/live/apps/settings/lib/Controller/AppSettingsController.php","line":451,"function":"installApp","class":"OC\\Installer","type":"->"},{"file":"/usr/home/nextcloud/live/lib/private/AppFramework/Http/Dispatcher.php","line":225,"function":"enableApps","class":"OCA\\Settings\\Controller\\AppSettingsController","type":"->"},{"file":"/usr/home/nextcloud/live/lib/private/AppFramework/Http/Dispatcher.php","line":133,"function":"executeController","class":"OC\\AppFramework\\Http\\Dispatcher","type":"->"},{"file":"/usr/home/nextcloud/live/lib/private/AppFramework/App.php","line":172,"function":"dispatch","class":"OC\\AppFramework\\Http\\Dispatcher","type":"->"},{"file":"/usr/home/nextcloud/live/lib/private/Route/Router.php","line":298,"function":"main","class":"OC\\AppFramework\\App","type":"::"},{"file":"/usr/home/nextcloud/live/lib/base.php","line":1047,"function":"match","class":"OC\\Route\\Router","type":"->"},{"file":"/usr/home/nextcloud/live/index.php","line":36,"function":"handleRequest","class":"OC","type":"::"}],"File":"/usr/home/nextcloud/live/3rdparty/doctrine/dbal/src/Driver/PDO/Exception.php","Line":26,"Previous":{"Exception":"PDOException","Message":"SQLSTATE[42704]: Undefined object: 7 ERROR: index \"primary\" does not exist","Code":"42704","Trace":[{"file":"/usr/home/nextcloud/live/3rdparty/doctrine/dbal/src/Driver/PDO/Connection.php","line":82,"function":"query","class":"PDO","type":"->"},{"file":"/usr/home/nextcloud/live/3rdparty/doctrine/dbal/src/Connection.php","line":1062,"function":"query","class":"Doctrine\\DBAL\\Driver\\PDO\\Connection","type":"->"},{"file":"/usr/home/nextcloud/live/lib/private/DB/Connection.php","line":261,"function":"executeQuery","class":"Doctrine\\DBAL\\Connection","type":"->"},{"file":"/usr/home/nextcloud/live/3rdparty/doctrine/dbal/src/Connection.php","line":1809,"function":"executeQuery","class":"OC\\DB\\Connection","type":"->"},{"file":"/usr/home/nextcloud/live/lib/private/DB/Migrator.php","line":162,"function":"query","class":"Doctrine\\DBAL\\Connection","type":"->"},{"file":"/usr/home/nextcloud/live/lib/private/DB/Migrator.php","line":69,"function":"applySchema","class":"OC\\DB\\Migrator","type":"->"},{"file":"/usr/home/nextcloud/live/lib/private/DB/Connection.php","line":582,"function":"migrate","class":"OC\\DB\\Migrator","type":"->"},{"file":"/usr/home/nextcloud/live/lib/private/DB/MigrationService.php","line":454,"function":"migrateToSchema","class":"OC\\DB\\Connection","type":"->"},{"file":"/usr/home/nextcloud/live/lib/private/DB/MigrationService.php","line":408,"function":"migrateSchemaOnly","class":"OC\\DB\\MigrationService","type":"->"},{"file":"/usr/home/nextcloud/live/lib/private/Installer.php","line":153,"function":"migrate","class":"OC\\DB\\MigrationService","type":"->"},{"file":"/usr/home/nextcloud/live/apps/settings/lib/Controller/AppSettingsController.php","line":451,"function":"installApp","class":"OC\\Installer","type":"->"},{"file":"/usr/home/nextcloud/live/lib/private/AppFramework/Http/Dispatcher.php","line":225,"function":"enableApps","class":"OCA\\Settings\\Controller\\AppSettingsController","type":"->"},{"file":"/usr/home/nextcloud/live/lib/private/AppFramework/Http/Dispatcher.php","line":133,"function":"executeController","class":"OC\\AppFramework\\Http\\Dispatcher","type":"->"},{"file":"/usr/home/nextcloud/live/lib/private/AppFramework/App.php","line":172,"function":"dispatch","class":"OC\\AppFramework\\Http\\Dispatcher","type":"->"},{"file":"/usr/home/nextcloud/live/lib/private/Route/Router.php","line":298,"function":"main","class":"OC\\AppFramework\\App","type":"::"},{"file":"/usr/home/nextcloud/live/lib/base.php","line":1047,"function":"match","class":"OC\\Route\\Router","type":"->"},{"file":"/usr/home/nextcloud/live/index.php","line":36,"function":"handleRequest","class":"OC","type":"::"}],"File":"/usr/home/nextcloud/live/3rdparty/doctrine/dbal/src/Driver/PDO/Connection.php","Line":82}},"message":"could not enable apps","exception":[],"CustomMessage":"could not enable apps"},"id":"63fa44db94226"}
Additional info
No response
Contributor guide
First steps
- Read the whole issue, then the project's contributing guide.
- Comment on the issue to say you are picking it up — it saves two people doing the same work.
- Fork the repository and make your change on a branch.
- Open a pull request that references the issue number.
Research direction
Start with the reported ./occ app:enable user_ldap reproduction and trace the failure through lib/private/DB/Migrator.php, lib/private/DB/MigrationService.php, lib/private/Installer.php, and apps/settings/lib/Controller/AppSettingsController.php. Check the PostgreSQL migration path and verify that user_ldap enables without the missing "primary" index error.
Written by the indexing model from the issue text.
Assessment
- Tech stack
- php, postgresql
- Domain
- databases
- Issue type
- Bug
- Difficulty
- 4/5
- Estimated time
- 3-5 days
- Activity status
- Stale
- Clarity
- Mostly clear
- Newbie friendliness
- 35/100