For SELECT DISTINCT, ORDER BY expressions must appear in select list

Somehow in the last few days I have started seeing error message:


I have checked psql logs and saw jsons that look like

{
  "level": "info",
  "ts": "2024-07-05T16:07:37Z",
  "logger": "postgres",
  "msg": "record",
  "logging_pod": "psql-vikunja-1",
  "record": {
    "log_time": "2024-07-05 16:07:37.398 UTC",
    "user_name": "app",
    "database_name": "app",
    "process_id": "1311",
    "connection_from": "10.0.2.208:32844",
    "session_id": "66881a48.51f",
    "session_line_num": "1",
    "command_tag": "PARSE",
    "session_start_time": "2024-07-05 16:07:36 UTC",
    "virtual_transaction_id": "6/3519",
    "transaction_id": "0",
    "error_severity": "ERROR",
    "sql_state_code": "42P10",
    "message": "for SELECT DISTINCT, ORDER BY expressions must appear in select list",
    "query": "SELECT DISTINCT \"tasks\".* FROM \"tasks\" LEFT JOIN \"task_positions\" ON task_positions.task_id = tasks.id AND task_positions.project_view_id = $1 WHERE \"id\" IN ($2,$3,$4,$5,$6) ORDER BY task_positions.\"position\" asc NULLS LAST, tasks.\"id\" asc NULLS LAST",
    "query_pos": "184",
    "backend_type": "client backend",
    "query_id": "0"
  }
}

I thought maybe I broke something so I reverted database back 2 days (back when everything worked) but I still am seeing this issue, is this expected?

It’s definitely not expected. Which version are you using?

Which view did you try to load when this happend?

Initially i restored database to 2 days ago (when i was on 0.23.0 at the time) but i kept my vikunja at latest tag (0.24.0 i think) and that didnt work (same errors).

Then I tried again, first restored database again to two days ago and set tag to 0.23.0 and everything worked.

The error appeared whenever i tried to open any project in the UI.

So that’s the list view?

Yes list view, sorry

I noticed the issue as well with unstable builds prior to the release, but it should be fixed by now (at least I can’t reproduce it).

Does it happen only with old projects?

Can you enable database logs and share them, only the logs leading up to the error?