nextcloud / server

☁️ Nextcloud server, a safe home for all your data
https://nextcloud.com
GNU Affero General Public License v3.0
26.89k stars 4.01k forks source link

Database conversion error: syntax error at or near ")" #26465

Closed Timoses closed 3 years ago

Timoses commented 3 years ago

How to use GitHub

Steps to reproduce

  1. php occ db:convert-type --port 5432 --password="mypw" pgsql nextcloud 127.0.0.1 nextcloud

Expected behaviour

Conversion should successfully run through as described here:

Actual behaviour

Error:

  An exception occurred while executing 'SELECT setval('oc_text_documents_id_seq',
   (SELECT MAX() FROM ))':

  SQLSTATE[42601]: Syntax error: 7 ERROR:  syntax error at or near ")"
  LINE 1: ...ECT setval('oc_text_documents_id_seq', (SELECT MAX() FROM ))
                                                                       ^

Server configuration

Operating system: DietPi

Web server: Lighttpd

Database: SQLite (trying to convert to PostgreSQL)

PHP version: Docker image: nextcloud:20-fpm

Nextcloud version: (see Nextcloud admin page) Docker image: nextcloud:20-fpm (Nextcloud 20.0.7)

Updated from an older Nextcloud/ownCloud or fresh install: Upgraded previously.

Where did you install Nextcloud from: Docker image.

Signing status:

Signing status ``` No errors have been found. ```

List of activated apps:

App list ``` Enabled: - accessibility: 1.6.0 - activity: 2.13.4 - bruteforcesettings: 2.0.1 - calendar: 2.1.3 - cloud_federation_api: 1.3.0 - comments: 1.10.0 - contacts: 3.4.3 - contactsinteraction: 1.1.0 - dashboard: 7.0.0 - dav: 1.16.2 - federatedfilesharing: 1.10.2 - federation: 1.10.1 - files: 1.15.0 - files_external: 1.11.1 - files_pdfviewer: 2.0.1 - files_rightclick: 0.17.0 - files_sharing: 1.12.2 - files_trashbin: 1.10.1 - files_versions: 1.13.0 - files_videoplayer: 1.9.0 - firstrunwizard: 2.9.0 - keeweb: 0.6.5 - logreader: 2.5.0 - lookup_server_connector: 1.8.0 - maps: 0.1.8 - music: 1.0.3 - nextcloud_announcements: 1.9.0 - notifications: 2.8.0 - oauth2: 1.8.0 - password_policy: 1.10.1 - photos: 1.2.3 - privacy: 1.4.0 - provisioning_api: 1.10.0 - recommendations: 0.8.0 - serverinfo: 1.10.0 - settings: 1.2.0 - sharebymail: 1.10.0 - support: 1.3.0 - survey_client: 1.8.0 - systemtags: 1.10.0 - text: 3.1.0 - theming: 1.11.0 - twofactor_backupcodes: 1.9.0 - unsplash: 1.2.1 - updatenotification: 1.10.0 - user_status: 1.0.1 - viewer: 1.4.0 - weather_status: 1.0.0 - workflowengine: 2.2.0 Disabled: - admin_audit - encryption - user_ldap```

Nextcloud configuration:

Config report ``` { "system": { "memcache.local": "\\OC\\Memcache\\APCu", "apps_paths": [ { "path": "\/var\/www\/html\/apps", "url": "\/apps", "writable": false }, { "path": "\/var\/www\/html\/custom_apps", "url": "\/custom_apps", "writable": true } ], "instanceid": "***REMOVED SENSITIVE VALUE***", "passwordsalt": "***REMOVED SENSITIVE VALUE***", "secret": "***REMOVED SENSITIVE VALUE***", "trusted_domains": [ "dietpi", "mydomain.mine" ], "datadirectory": "***REMOVED SENSITIVE VALUE***", "dbtype": "sqlite3", "version": "20.0.7.1", "overwrite.cli.url": "https:\/\/dietpi", "installed": true, "maintenance": false, "theme": "", "loglevel": 2, "versions_retention_obligation": "auto" } }```

Are you using external storage, if yes which one: local

Are you using encryption: yes (web server uses encryption via HTTPS. File system is not encrypted.)

Are you using an external user-backend, if yes which one: no

Client configuration

Browser: firefox

Operating system: macos

Logs

www-data@DietPi:~/html$ php occ db:convert-type --port 5432 --password="mypw" pgsql nextcloud 127.0.0.1 nextcloud
Creating schema in new database
The following tables will not be converted:
oc_news_feeds
oc_news_folders
oc_news_items
Please note that tables belonging to available but currently not installed apps
can be included by specifying the --all-apps option.
Continue with the conversion (y/n)? [n] y
oc_migrations
Skipping migrations table because it was already filled by running the migrations
oc_appconfig
 191/191 [============================] 100%oc_storages
 4/4 [============================] 100%oc_recent_contact
    0 [>---------------------------]oc_mimetypes
 85/85 [============================] 100%oc_filecache
chunked query, 303 chunks
 302470/302470 [============================] 100%oc_addressbooks
 3/3 [============================] 100%oc_group_user
 1/1 [============================] 100%oc_group_admin
    0 [>---------------------------]oc_groups
 1/1 [============================] 100%oc_preferences
 99/99 [============================] 100%oc_cards
 64/64 [============================] 100%oc_properties
 6/6 [============================] 100%oc_users
 2/2 [============================] 100%oc_calendars
 6/6 [============================] 100%oc_schedulingobjects
    0 [>---------------------------]oc_calendarobjects
 142/142 [============================] 100%oc_calendarchanges
 446/446 [============================] 100%oc_calendarsubscriptions
    0 [>---------------------------]oc_cards_properties
 387/387 [============================] 100%oc_calendarobjects_props
chunked query, 5 chunks
 4781/4781 [============================] 100%oc_comments_read_markers
    0 [>---------------------------]oc_systemtag_object_mapping
    0 [>---------------------------]oc_accounts
 2/2 [============================] 100%oc_addressbookchanges
 308/308 [============================] 100%oc_mounts
 2/2 [============================] 100%oc_dav_shares
    0 [>---------------------------]oc_directlink
 1/1 [============================] 100%oc_calendar_resources
    0 [>---------------------------]oc_calendar_rooms
    0 [>---------------------------]oc_share
 1/1 [============================] 100%oc_calendar_invitations
    0 [>---------------------------]oc_jobs
chunked query, 2 chunks
 1004/1004 [============================] 100%oc_calendar_resources_md
    0 [>---------------------------]oc_bruteforce_attempts
 17/17 [============================] 100%oc_calendar_rooms_md
    0 [>---------------------------]oc_vcategory
    0 [>---------------------------]oc_dav_cal_proxy
    0 [>---------------------------]oc_share_external
    0 [>---------------------------]oc_authtoken
 132/132 [============================] 100%oc_vcategory_to_object
    0 [>---------------------------]oc_calendar_reminders
 62/62 [============================] 100%oc_systemtag
    0 [>---------------------------]oc_federated_reshares
    0 [>---------------------------]oc_systemtag_group
    0 [>---------------------------]oc_trusted_servers
    0 [>---------------------------]oc_file_locks
chunked query, 49 chunks
 48666/48666 [============================] 100%oc_external_mounts
 1/1 [============================] 100%oc_external_applicable
 1/1 [============================] 100%oc_external_config
 1/1 [============================] 100%oc_comments
    0 [>---------------------------]oc_twofactor_providers
 2/2 [============================] 100%oc_whats_new
 3/3 [============================] 100%oc_collres_collections
 1/1 [============================] 100%oc_collres_resources
 1/1 [============================] 100%oc_login_flow_v2
    0 [>---------------------------]oc_collres_accesscache
    0 [>---------------------------]oc_filecache_extended
 736/736 [============================] 100%oc_direct_edit
    0 [>---------------------------]oc_webauthn
    0 [>---------------------------]oc_storages_credentials
 3/3 [============================] 100%oc_user_transfer_owner
    0 [>---------------------------]oc_activity
chunked query, 199 chunks
 144800/198229 [====================>-------]  73%
 145800/198229 [====================>-------]  73%
 146800/198229 [====================>-------]  74%
 149300/198229 [=====================>------]  75%
 152500/198229 [=====================>------]  76%
 198229/198229 [============================] 100%oc_activity_mq
    0 [>---------------------------]oc_external_options
 6/6 [============================] 100%oc_files_trash
 44/44 [============================] 100%oc_maps_favorites
 27/27 [============================] 100%oc_maps_apikeys
    0 [>---------------------------]oc_maps_photos
    0 [>---------------------------]oc_maps_tracks
    0 [>---------------------------]oc_maps_devices
    0 [>---------------------------]oc_maps_device_points
    0 [>---------------------------]oc_maps_address_geo
 7/7 [============================] 100%oc_maps_favorite_shares
    0 [>---------------------------]oc_music_artists
chunked query, 2 chunks
 1417/1417 [============================] 100%oc_music_albums
chunked query, 2 chunks
 1603/1603 [============================] 100%oc_music_tracks
chunked query, 6 chunks
 5218/5218 [============================] 100%oc_music_playlists
 4/4 [============================] 100%oc_music_genres
 157/157 [============================] 100%oc_music_radio_stations
    0 [>---------------------------]oc_music_ampache_sessions
    0 [>---------------------------]oc_music_ampache_users
 3/3 [============================] 100%oc_music_cache
    0 [>---------------------------]oc_music_bookmarks
    0 [>---------------------------]oc_notifications
 1/1 [============================] 100%oc_notifications_pushtokens
 2/2 [============================] 100%oc_oauth2_clients
    0 [>---------------------------]oc_oauth2_access_tokens
    0 [>---------------------------]oc_privacy_admins
    0 [>---------------------------]oc_text_documents
    0 [>---------------------------]oc_text_sessions
    0 [>---------------------------]oc_text_steps
    0 [>---------------------------]oc_twofactor_backupcodes
 27/27 [============================] 100%oc_user_status
 2/2 [============================] 100%oc_flow_checks
    0 [>---------------------------]oc_flow_operations
    0 [>---------------------------]oc_flow_operations_scope
    0 [>---------------------------]
In AbstractPostgreSQLDriver.php line 54:

  An exception occurred while executing 'SELECT setval('oc_text_documents_id_seq',
   (SELECT MAX() FROM ))':

  SQLSTATE[42601]: Syntax error: 7 ERROR:  syntax error at or near ")"
  LINE 1: ...ECT setval('oc_text_documents_id_seq', (SELECT MAX() FROM ))
                                                                       ^

In PDOConnection.php line 83:

  SQLSTATE[42601]: Syntax error: 7 ERROR:  syntax error at or near ")"
  LINE 1: ...ECT setval('oc_text_documents_id_seq', (SELECT MAX() FROM ))
                                                                       ^

In PDOConnection.php line 78:

  SQLSTATE[42601]: Syntax error: 7 ERROR:  syntax error at or near ")"
  LINE 1: ...ECT setval('oc_text_documents_id_seq', (SELECT MAX() FROM ))
                                                                       ^

I am not sure where this error stems from. Is it from a malformed entry of an app? Or is it a problem with the conversion script?

csullivannet commented 3 years ago

This appears to be a duplicate of https://github.com/nextcloud/server/issues/24884

szaimen commented 3 years ago

There was an enhancement recently concerning the conversion. Please try again when NC21.0.3 is out and report back! Thanks! :)

ghost commented 3 years ago

This issue has been automatically marked as stale because it has not had recent activity and seems to be missing some essential information. It will be closed if no further activity occurs. Thank you for your contributions.