nextcloud / server

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

[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

Closed js-d-coder closed 1 month ago

js-d-coder commented 1 month ago

⚠️ 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?

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:

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

solracsf commented 1 month ago

Duplicate of https://github.com/nextcloud/server/issues/47977 (fixed by https://github.com/nextcloud/server/pull/47399)