Skip to content

[Bug]: DriverException An exception occurred while executing a query: SQLSTATE[42803]: Grouping error: 7 ERROR: column "cr.id" must appear in the GROUP BY clause or be used in an aggregate function LINE 1: SELECT "cr".*, "co"."calendardata", "c"."displayname", "c"."... ^ #48671

@js-d-coder

Description

@js-d-coder

⚠️ This issue respects the following points: ⚠️

Bug description

Hi,
Following error is getting logged every 5 minutes.

Unformatted:

 DriverException An exception occurred while executing a query: SQLSTATE[42803]: Grouping error: 7 ERROR: column "cr.id" must appear in the GROUP BY clause or be used in an aggregate function LINE 1: SELECT "cr".*, "co"."calendardata", "c"."displayname", "c"."... ^

    /var/www/html/nxc/3rdparty/doctrine/dbal/src/Connection.phpLine 1943

    Doctrine\DBAL\Driver\API\PostgreSQL\ExceptionConverter->convert()

    /var/www/html/nxc/3rdparty/doctrine/dbal/src/Connection.phpLine 1885

    Doctrine\DBAL\Connection->handleDriverException()

    /var/www/html/nxc/3rdparty/doctrine/dbal/src/Connection.phpLine 1106

    Doctrine\DBAL\Connection->convertExceptionDuringQuery()

    /var/www/html/nxc/lib/private/DB/Connection.phpLine 415

    Doctrine\DBAL\Connection->executeQuery()

    /var/www/html/nxc/lib/private/DB/ConnectionAdapter.phpLine 50

    OC\DB\Connection->executeQuery()

    /var/www/html/nxc/lib/private/DB/QueryBuilder/QueryBuilder.phpLine 272

    OC\DB\ConnectionAdapter->executeQuery()

    /var/www/html/nxc/lib/private/DB/QueryBuilder/QueryBuilder.phpLine 249

    OC\DB\QueryBuilder\QueryBuilder->executeQuery()

    /var/www/html/nxc/apps/dav/lib/CalDAV/Reminder/Backend.phpLine 53

    OC\DB\QueryBuilder\QueryBuilder->execute()

    /var/www/html/nxc/apps/dav/lib/CalDAV/Reminder/ReminderService.phpLine 104

    OCA\DAV\CalDAV\Reminder\Backend->getRemindersToProcess()

    /var/www/html/nxc/apps/dav/lib/BackgroundJob/EventReminderJob.phpLine 50

    OCA\DAV\CalDAV\Reminder\ReminderService->processReminders()

    /var/www/html/nxc/lib/public/BackgroundJob/Job.phpLine 61

    OCA\DAV\BackgroundJob\EventReminderJob->run()

    /var/www/html/nxc/lib/public/BackgroundJob/TimedJob.phpLine 83

    OCP\BackgroundJob\Job->start()

    /var/www/html/nxc/lib/public/BackgroundJob/TimedJob.phpLine 73

    OCP\BackgroundJob\TimedJob->start()

    /var/www/html/nxc/cron.phpLine 162

    OCP\BackgroundJob\TimedJob->execute()

Caused by Exception SQLSTATE[42803]: Grouping error: 7 ERROR: column "cr.id" must appear in the GROUP BY clause or be used in an aggregate function LINE 1: SELECT "cr".*, "co"."calendardata", "c"."displayname", "c"."... ^
Raw log entry

{
  "reqId": "d6SkIAeaNL465et5kFW2",
  "level": 3,
  "time": "2024-10-12T07:15:02+00:00",
  "remoteAddr": "",
  "user": "--",
  "app": "core",
  "method": "",
  "url": "--",
  "message": "Error while running background job OCA\\DAV\\BackgroundJob\\EventReminderJob (id: 2900, arguments: null)",
  "userAgent": "--",
  "version": "30.0.0.14",
  "exception": {
    "Exception": "Doctrine\\DBAL\\Exception\\DriverException",
    "Message": "An exception occurred while executing a query: SQLSTATE[42803]: Grouping error: 7 ERROR:  column \"cr.id\" must appear in the GROUP BY clause or be used in an aggregate function\nLINE 1: SELECT \"cr\".*, \"co\".\"calendardata\", \"c\".\"displayname\", \"c\".\"...\n               ^",
    "Code": 7,
    "Trace": [
      {
        "file": "/var/www/html/nxc/3rdparty/doctrine/dbal/src/Connection.php",
        "line": 1943,
        "function": "convert",
        "class": "Doctrine\\DBAL\\Driver\\API\\PostgreSQL\\ExceptionConverter",
        "type": "->"
      },
      {
        "file": "/var/www/html/nxc/3rdparty/doctrine/dbal/src/Connection.php",
        "line": 1885,
        "function": "handleDriverException",
        "class": "Doctrine\\DBAL\\Connection",
        "type": "->"
      },
      {
        "file": "/var/www/html/nxc/3rdparty/doctrine/dbal/src/Connection.php",
        "line": 1106,
        "function": "convertExceptionDuringQuery",
        "class": "Doctrine\\DBAL\\Connection",
        "type": "->"
      },
      {
        "file": "/var/www/html/nxc/lib/private/DB/Connection.php",
        "line": 415,
        "function": "executeQuery",
        "class": "Doctrine\\DBAL\\Connection",
        "type": "->"
      },
      {
        "file": "/var/www/html/nxc/lib/private/DB/ConnectionAdapter.php",
        "line": 50,
        "function": "executeQuery",
        "class": "OC\\DB\\Connection",
        "type": "->"
      },
      {
        "file": "/var/www/html/nxc/lib/private/DB/QueryBuilder/QueryBuilder.php",
        "line": 272,
        "function": "executeQuery",
        "class": "OC\\DB\\ConnectionAdapter",
        "type": "->"
      },
      {
        "file": "/var/www/html/nxc/lib/private/DB/QueryBuilder/QueryBuilder.php",
        "line": 249,
        "function": "executeQuery",
        "class": "OC\\DB\\QueryBuilder\\QueryBuilder",
        "type": "->"
      },
      {
        "file": "/var/www/html/nxc/apps/dav/lib/CalDAV/Reminder/Backend.php",
        "line": 53,
        "function": "execute",
        "class": "OC\\DB\\QueryBuilder\\QueryBuilder",
        "type": "->"
      },
      {
        "file": "/var/www/html/nxc/apps/dav/lib/CalDAV/Reminder/ReminderService.php",
        "line": 104,
        "function": "getRemindersToProcess",
        "class": "OCA\\DAV\\CalDAV\\Reminder\\Backend",
        "type": "->"
      },
      {
        "file": "/var/www/html/nxc/apps/dav/lib/BackgroundJob/EventReminderJob.php",
        "line": 50,
        "function": "processReminders",
        "class": "OCA\\DAV\\CalDAV\\Reminder\\ReminderService",
        "type": "->"
      },
      {
        "file": "/var/www/html/nxc/lib/public/BackgroundJob/Job.php",
        "line": 61,
        "function": "run",
        "class": "OCA\\DAV\\BackgroundJob\\EventReminderJob",
        "type": "->"
      },
      {
        "file": "/var/www/html/nxc/lib/public/BackgroundJob/TimedJob.php",
        "line": 83,
        "function": "start",
        "class": "OCP\\BackgroundJob\\Job",
        "type": "->"
      },
      {
        "file": "/var/www/html/nxc/lib/public/BackgroundJob/TimedJob.php",
        "line": 73,
        "function": "start",
        "class": "OCP\\BackgroundJob\\TimedJob",
        "type": "->"
      },
      {
        "file": "/var/www/html/nxc/cron.php",
        "line": 162,
        "function": "execute",
        "class": "OCP\\BackgroundJob\\TimedJob",
        "type": "->"
      }
    ],
    "File": "/var/www/html/nxc/3rdparty/doctrine/dbal/src/Driver/API/PostgreSQL/ExceptionConverter.php",
    "Line": 87,
    "Previous": {
      "Exception": "Doctrine\\DBAL\\Driver\\PDO\\Exception",
      "Message": "SQLSTATE[42803]: Grouping error: 7 ERROR:  column \"cr.id\" must appear in the GROUP BY clause or be used in an aggregate function\nLINE 1: SELECT \"cr\".*, \"co\".\"calendardata\", \"c\".\"displayname\", \"c\".\"...\n               ^",
      "Code": 7,
      "Trace": [
        {
          "file": "/var/www/html/nxc/3rdparty/doctrine/dbal/src/Driver/PDO/Statement.php",
          "line": 132,
          "function": "new",
          "class": "Doctrine\\DBAL\\Driver\\PDO\\Exception",
          "type": "::"
        },
        {
          "file": "/var/www/html/nxc/3rdparty/doctrine/dbal/src/Connection.php",
          "line": 1099,
          "function": "execute",
          "class": "Doctrine\\DBAL\\Driver\\PDO\\Statement",
          "type": "->"
        },
        {
          "file": "/var/www/html/nxc/lib/private/DB/Connection.php",
          "line": 415,
          "function": "executeQuery",
          "class": "Doctrine\\DBAL\\Connection",
          "type": "->"
        },
        {
          "file": "/var/www/html/nxc/lib/private/DB/ConnectionAdapter.php",
          "line": 50,
          "function": "executeQuery",
          "class": "OC\\DB\\Connection",
          "type": "->"
        },
        {
          "file": "/var/www/html/nxc/lib/private/DB/QueryBuilder/QueryBuilder.php",
          "line": 272,
          "function": "executeQuery",
          "class": "OC\\DB\\ConnectionAdapter",
          "type": "->"
        },
        {
          "file": "/var/www/html/nxc/lib/private/DB/QueryBuilder/QueryBuilder.php",
          "line": 249,
          "function": "executeQuery",
          "class": "OC\\DB\\QueryBuilder\\QueryBuilder",
          "type": "->"
        },
        {
          "file": "/var/www/html/nxc/apps/dav/lib/CalDAV/Reminder/Backend.php",
          "line": 53,
          "function": "execute",
          "class": "OC\\DB\\QueryBuilder\\QueryBuilder",
          "type": "->"
        },
        {
          "file": "/var/www/html/nxc/apps/dav/lib/CalDAV/Reminder/ReminderService.php",
          "line": 104,
          "function": "getRemindersToProcess",
          "class": "OCA\\DAV\\CalDAV\\Reminder\\Backend",
          "type": "->"
        },
        {
          "file": "/var/www/html/nxc/apps/dav/lib/BackgroundJob/EventReminderJob.php",
          "line": 50,
          "function": "processReminders",
          "class": "OCA\\DAV\\CalDAV\\Reminder\\ReminderService",
          "type": "->"
        },
        {
          "file": "/var/www/html/nxc/lib/public/BackgroundJob/Job.php",
          "line": 61,
          "function": "run",
          "class": "OCA\\DAV\\BackgroundJob\\EventReminderJob",
          "type": "->"
        },
        {
          "file": "/var/www/html/nxc/lib/public/BackgroundJob/TimedJob.php",
          "line": 83,
          "function": "start",
          "class": "OCP\\BackgroundJob\\Job",
          "type": "->"
        },
        {
          "file": "/var/www/html/nxc/lib/public/BackgroundJob/TimedJob.php",
          "line": 73,
          "function": "start",
          "class": "OCP\\BackgroundJob\\TimedJob",
          "type": "->"
        },
        {
          "file": "/var/www/html/nxc/cron.php",
          "line": 162,
          "function": "execute",
          "class": "OCP\\BackgroundJob\\TimedJob",
          "type": "->"
        }
      ],
      "File": "/var/www/html/nxc/3rdparty/doctrine/dbal/src/Driver/PDO/Exception.php",
      "Line": 28,
      "Previous": {
        "Exception": "PDOException",
        "Message": "SQLSTATE[42803]: Grouping error: 7 ERROR:  column \"cr.id\" must appear in the GROUP BY clause or be used in an aggregate function\nLINE 1: SELECT \"cr\".*, \"co\".\"calendardata\", \"c\".\"displayname\", \"c\".\"...\n               ^",
        "Code": "42803",
        "Trace": [
          {
            "file": "/var/www/html/nxc/3rdparty/doctrine/dbal/src/Driver/PDO/Statement.php",
            "line": 130,
            "function": "execute",
            "class": "PDOStatement",
            "type": "->"
          },
          {
            "file": "/var/www/html/nxc/3rdparty/doctrine/dbal/src/Connection.php",
            "line": 1099,
            "function": "execute",
            "class": "Doctrine\\DBAL\\Driver\\PDO\\Statement",
            "type": "->"
          },
          {
            "file": "/var/www/html/nxc/lib/private/DB/Connection.php",
            "line": 415,
            "function": "executeQuery",
            "class": "Doctrine\\DBAL\\Connection",
            "type": "->"
          },
          {
            "file": "/var/www/html/nxc/lib/private/DB/ConnectionAdapter.php",
            "line": 50,
            "function": "executeQuery",
            "class": "OC\\DB\\Connection",
            "type": "->"
          },
          {
            "file": "/var/www/html/nxc/lib/private/DB/QueryBuilder/QueryBuilder.php",
            "line": 272,
            "function": "executeQuery",
            "class": "OC\\DB\\ConnectionAdapter",
            "type": "->"
          },
          {
            "file": "/var/www/html/nxc/lib/private/DB/QueryBuilder/QueryBuilder.php",
            "line": 249,
            "function": "executeQuery",
            "class": "OC\\DB\\QueryBuilder\\QueryBuilder",
            "type": "->"
          },
          {
            "file": "/var/www/html/nxc/apps/dav/lib/CalDAV/Reminder/Backend.php",
            "line": 53,
            "function": "execute",
            "class": "OC\\DB\\QueryBuilder\\QueryBuilder",
            "type": "->"
          },
          {
            "file": "/var/www/html/nxc/apps/dav/lib/CalDAV/Reminder/ReminderService.php",
            "line": 104,
            "function": "getRemindersToProcess",
            "class": "OCA\\DAV\\CalDAV\\Reminder\\Backend",
            "type": "->"
          },
          {
            "file": "/var/www/html/nxc/apps/dav/lib/BackgroundJob/EventReminderJob.php",
            "line": 50,
            "function": "processReminders",
            "class": "OCA\\DAV\\CalDAV\\Reminder\\ReminderService",
            "type": "->"
          },
          {
            "file": "/var/www/html/nxc/lib/public/BackgroundJob/Job.php",
            "line": 61,
            "function": "run",
            "class": "OCA\\DAV\\BackgroundJob\\EventReminderJob",
            "type": "->"
          },
          {
            "file": "/var/www/html/nxc/lib/public/BackgroundJob/TimedJob.php",
            "line": 83,
            "function": "start",
            "class": "OCP\\BackgroundJob\\Job",
            "type": "->"
          },
          {
            "file": "/var/www/html/nxc/lib/public/BackgroundJob/TimedJob.php",
            "line": 73,
            "function": "start",
            "class": "OCP\\BackgroundJob\\TimedJob",
            "type": "->"
          },
          {
            "file": "/var/www/html/nxc/cron.php",
            "line": 162,
            "function": "execute",
            "class": "OCP\\BackgroundJob\\TimedJob",
            "type": "->"
          }
        ],
        "File": "/var/www/html/nxc/3rdparty/doctrine/dbal/src/Driver/PDO/Statement.php",
        "Line": 130
      }
    },
    "message": "Error while running background job OCA\\DAV\\BackgroundJob\\EventReminderJob (id: 2900, arguments: null)",
    "exception": [],
    "CustomMessage": "Error while running background job OCA\\DAV\\BackgroundJob\\EventReminderJob (id: 2900, arguments: null)"
  },
  "id": "670a2dbac7c4b"
}

Steps to reproduce

  1. Watch system logs

Expected behavior

No such errors.

Nextcloud Server version

30

Operating system

Debian/Ubuntu

PHP engine version

PHP 8.3

Web server

Nginx

Database engine version

PostgreSQL

Is this bug present after an update or on a fresh install?

Upgraded to a MAJOR version (ex. 28 to 29)

Are you using the Nextcloud Server Encryption module?

None

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*"
],
"enable_previews": true,
"enabledPreviewProviders": [
"OC\Preview\BMP",
"OC\Preview\GIF",
"OC\Preview\JPEG",
"OC\Preview\MP3",
"OC\Preview\OpenDocument",
"OC\Preview\PNG",
"OC\Preview\TXT",
"OC\Preview\XBitmap",
"OC\Preview\Movie",
"OC\Preview\MP4",
"OC\Preview\AVI",
"OC\Preview\MKV",
"OC\Preview\Image",
"OC\Preview\HEIC",
"OC\Preview\TIFF"
],
"datadirectory": "REMOVED SENSITIVE VALUE",
"dbtype": "pgsql",
"version": "30.0.0.14",
"overwrite.cli.url": "REMOVED SENSITIVE VALUE*",
"forcessl": true,
"overwriteprotocol": "https",
"dbname": "REMOVED SENSITIVE VALUE",
"dbhost": "REMOVED SENSITIVE VALUE",
"dbport": "5432",
"dbtableprefix": "oc_",
"dbuser": "REMOVED SENSITIVE VALUE",
"dbpassword": "REMOVED SENSITIVE VALUE",
"installed": true,
"maintenance": false,
"theme": "",
"loglevel": 1,
"log_type": "file",
"logfile": "/var/www/nextcloud-data/nextcloud.log",
"logfilemode": 416,
"memcache.locking": "\OC\Memcache\Redis",
"memcache.local": "\OC\Memcache\APCu",
"memcache.distributed": "\OC\Memcache\Redis",
"updater.release.channel": "stable",
"filelocking.enabled": "true",
"redis": {
"host": "REMOVED SENSITIVE VALUE",
"port": 6379
},
"has_rebuilt_cache": true,
"twofactor_enforced": "true",
"twofactor_enforced_groups": [
"admin"
],
"twofactor_enforced_excluded_groups": [],
"mail_smtpmode": "smtp",
"mail_sendmailmode": "smtp",
"mail_from_address": "REMOVED SENSITIVE VALUE",
"mail_domain": "REMOVED SENSITIVE VALUE",
"mail_smtphost": "REMOVED SENSITIVE VALUE",
"mail_smtpsecure": "tls",
"mail_smtpauthtype": "PLAIN",
"mail_smtpauth": 1,
"mail_smtpname": "REMOVED SENSITIVE VALUE",
"mail_smtppassword": "REMOVED SENSITIVE VALUE",
"mail_smtpport": "587",
"default_phone_region": "IN",
"defaultapp": "dashboard",
"app_install_overwrite": [
"mindmap_app",
"files_videoplayer",
"issuetemplate"
],
"maintenance_window_start": 1,
"memories.exiftool": "/var/www/html/nxc/apps/memories/bin-ext/exiftool-amd64-glibc",
"memories.vod.path": "/var/www/html/nxc/apps/memories/bin-ext/go-vod-amd64",
"memories.vod.ffmpeg": "/usr/bin/ffmpeg",
"memories.vod.ffprobe": "/usr/bin/ffprobe",
"preview_max_x": 512,
"preview_max_y": 512,
"memories.db.triggers.fcu": true,
"memories.gis_type": 2
}
}

List of activated Apps

Enabled:

  • admin_audit: 1.20.0
  • audioplayer: 3.4.1
  • bruteforcesettings: 3.0.0
  • calendar: 5.0.0
  • cloud_federation_api: 1.13.0
  • comments: 1.20.1
  • contacts: 6.1.0
  • contactsinteraction: 1.11.0
  • dashboard: 7.10.0
  • dav: 1.31.1
  • deck: 1.14.1
  • event_update_notification: 2.5.0
  • federatedfilesharing: 1.20.0
  • files: 2.2.0
  • files_downloadlimit: 3.0.0
  • files_external: 1.22.0
  • files_pdfviewer: 3.0.0
  • files_reminders: 1.3.0
  • files_sharing: 1.22.0
  • files_trashbin: 1.20.1
  • files_versions: 1.23.0
  • firstrunwizard: 3.0.0
  • logreader: 3.0.0
  • lookup_server_connector: 1.18.0
  • memories: 7.4.1
  • metadata: 0.21.0
  • nextcloud_announcements: 2.0.0
  • notes: 4.11.0
  • notifications: 3.0.0
  • oauth2: 1.18.1
  • password_policy: 2.0.0
  • photos: 3.0.2
  • previewgenerator: 5.6.0
  • privacy: 2.0.0
  • provisioning_api: 1.20.0
  • quota_warning: 1.20.0
  • serverinfo: 2.0.0
  • settings: 1.13.0
  • sharebymail: 1.20.0
  • survey_client: 2.0.0
  • suspicious_login: 8.0.0
  • tasks: 0.16.1
  • text: 4.1.0
  • theming: 2.5.0
  • twofactor_backupcodes: 1.19.0
  • twofactor_nextcloud_notification: 4.0.0
  • twofactor_totp: 12.0.0-dev
  • twofactor_webauthn: 2.0.0
  • updatenotification: 1.20.0
  • viewer: 3.0.0
  • webhook_listeners: 1.1.0-dev
  • whiteboard: 1.0.3
  • workflowengine: 2.12.0
    Disabled:
  • accessibility: 1.10.0
  • activity: 3.0.0 (installed 2.20.0)
  • backup: 1.4.0 (installed 1.4.0)
  • camerarawpreviews: 0.8.5 (installed 0.8.5)
  • circles: 30.0.0-dev (installed 28.0.0)
  • encryption: 2.18.0 (installed 2.16.0)
  • federation: 1.20.0 (installed 1.4.0)
  • files_mindmap: 0.0.30 (installed 0.0.30)
  • files_rightclick: 1.6.0 (installed 1.6.0)
  • issuetemplate: 0.7.0 (installed 0.7.0)
  • music: 2.0.1 (installed 2.0.1)
  • recommendations: 3.0.0 (installed 2.0.0)
  • related_resources: 1.5.0 (installed 1.3.0)
  • support: 2.0.0 (installed 1.11.1)
  • systemtags: 1.20.0 (installed 1.18.0)
  • user_ldap: 1.21.0 (installed 1.19.0)
  • user_status: 1.10.0 (installed 1.8.1)
  • weather_status: 1.10.0 (installed 1.8.0)

Nextcloud Signing status

404 not found

Nextcloud Logs

(already pasted above)

Additional info

Nextcloud Hub 9 (30.0.0)
Ubuntu 22.04
Postgresql 17+264.pgdg22.04+1
php-common 2:95+ubuntu22.04.1+deb.sury.org+1
php 2:8.3+95+ubuntu22.04.1+deb.sury.org+1
nginx 1.18.0-6ubuntu14.5

Metadata

Metadata

Assignees

No one assigned

    Labels

    0. Needs triagePending check for reproducibility or if it fits our roadmapbug

    Type

    No type

    Projects

    No projects

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions