nextcloud / nextcloud/tables

Export fails with Syntax error 7 in SQL during 'oc_tables_shares' export.

Open
#2,780 1 comment 0 reactions 0 assignees View on GitHub

Nobody has claimed this yet.

0. Needs triage bug
Dominant language
JavaScript
Stars
214
Forks
52
Avg merge
1d 10h
Merged PRs (30d)
82

Description

How to use GitHub
  • Please use the 👍 reaction to show that you are affected by the same issue.
  • Please don't comment if you have no relevant information to add. It's just extra noise for everyone subscribed to this issue.
  • Subscribe to receive notifications on status change and new comments.

Steps to reproduce
  1. Click on Export in the Nextcloud 33.0.5 Version with all checkboxes active
  2. run the cronjob cron.php manually from occ Commandline
  3. wait until it is completed
Expected behaviour

The export should be ready to download, I guess.

Actual behaviour

There is an error shown, that the Export went wrong:
Image

Server configuration

Web server: Caddy

Database: PostgreSQL

PHP version: 8.4

Nextcloud version: 33.0.5

List of activated apps
Enabled:
  - activity: 6.0.0
  - admin_audit: 1.23.0
  - announcementcenter: 7.4.0
  - app_api: 33.0.0
  - bruteforcesettings: 6.0.0
  - circles: 33.0.0
  - cloud_federation_api: 1.17.0
  - collectives: 4.4.1
  - comments: 1.23.0
  - contactsinteraction: 1.14.1
  - dashboard: 7.13.0
  - dav: 1.36.0
  - deck: 1.17.2
  - federatedfilesharing: 1.23.0
  - federation: 1.23.0
  - files: 2.5.0
  - files_3dmodelviewer: 0.0.16
  - files_antivirus: 6.2.0
  - files_downloadlimit: 5.1.0
  - 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
  - firstrunwizard: 6.0.0
  - forms: 5.2.9
  - groupfolders: 21.0.7
  - logreader: 6.0.0
  - lookup_server_connector: 1.21.0
  - nextcloud_announcements: 5.0.0
  - notes: 6.0.0
  - notifications: 6.0.0
  - oauth2: 1.21.0
  - oidc_groups_mapping: 1.2.0
  - password_policy: 5.0.0
  - passwords: 2026.5.20
  - photos: 6.0.0
  - privacy: 5.0.0
  - profile: 1.2.0
  - provisioning_api: 1.23.0
  - quota_warning: 1.23.0
  - recommendations: 6.0.0
  - related_resources: 4.0.0
  - richdocuments: 10.1.3
  - serverinfo: 5.0.0
  - settings: 1.16.0
  - sharebymail: 1.23.0
  - spreed: 23.0.6
  - support: 5.0.0
  - survey_client: 5.0.0
  - systemtags: 1.23.0
  - tables: 2.2.0
  - text: 7.0.1
  - theming: 2.8.0
  - twofactor_backupcodes: 1.22.0
  - updatenotification: 1.23.0
  - user_migration: 10.3.0
  - user_oidc: 8.10.1
  - user_status: 1.13.0
  - viewer: 6.0.0
  - weather_status: 1.13.0
  - webhook_listeners: 1.5.0
  - whiteboard: 1.5.9
  - workflowengine: 2.15.0
### Browser

Browser name: Firefox to schedule the export

Browser version: 151

Operating system: Arch Linux

Nextcloud log excerpts
{
   "reqId":"***************",
   "level":3,
   "time":"2026-06-25T09:16:21+00:00",
   "remoteAddr":"",
   "user":"--",
   "app":"user_migration",
   "method":"",
   "message":"An exception occurred while executing a query: SQLSTATE[42601]: Syntax error: 7 ERROR:  syntax error at or near \")\"\nLINE 1: SELECT * FROM \"oc_tables_shares\" WHERE ()\n                                                ^",
   "userAgent":"--",
   "version":"33.0.5.1",
   "occ_command":[
      "/var/www/html/cron.php"
   ],
   "exception":{
      "Exception":"OCA\\Tables\\UserMigration\\TableMigratorException",
      "Message":"An exception occurred while executing a query: SQLSTATE[42601]: Syntax error: 7 ERROR:  syntax error at or near \")\"\nLINE 1: SELECT * FROM \"oc_tables_shares\" WHERE ()\n^",
      "Code":0,
      "Trace":[
         {
            "file":"/var/www/html/custom_apps/user_migration/lib/Service/UserMigrationService.php",
            "line":182,
            "function":"export",
            "class":"OCA\\Tables\\UserMigration\\TablesMigrator",
            "type":"->",
            "args":[
               {
                  "__class__":"OC\\User\\User"
               },
               {
                  "__class__":"OCA\\UserMigration\\UserFolderExportDestination"
               },
               {
                  "__class__":"Symfony\\Component\\Console\\Output\\NullOutput"
               }
            ]
         },
         {
            "file":"/var/www/html/custom_apps/user_migration/lib/BackgroundJob/UserExportJob.php",
            "line":73,
            "function":"export",
            "class":"OCA\\UserMigration\\Service\\UserMigrationService",
            "type":"->",
            "args":[
               {
                  "__class__":"OCA\\UserMigration\\UserFolderExportDestination"
               },
               {
                  "__class__":"OC\\User\\User"
               },
               [
                  "forms",
                  "passwords",
                  "tables",
                  "files",
                  "trashbin",
                  "And 3 more entries, set log level to debug to see all entries"
               ]
            ]
         },
     [.........]
    }
}

Contributor guide

Open the contributing guide

First steps

  1. Read the whole issue, then the project's contributing guide.
  2. Comment on the issue to say you are picking it up — it saves two people doing the same work.
  3. Fork the repository and make your change on a branch.
  4. Open a pull request that references the issue number.

Research direction

Start with cron.php and the TablesMigrator export path shown in the trace, especially UserMigrationService.php around line 182. Follow how the oc_tables_shares query is assembled and reproduce the export with all checkboxes active. Done means the cron export completes without the PostgreSQL WHERE () syntax error and produces a downloadable export.

Written by the indexing model from the issue text.

Assessment

Tech stack
php, postgresql
Domain
backend, databases
Issue type
Bug
Difficulty
4/5
Estimated time
3-5 days
Activity status
Quiet
Clarity
Mostly clear
Newbie friendliness
48/100

Get new issues in your inbox

A short digest of beginner-friendly GitHub issues.