Empty conditions groups might break the query due to empty where generated

Created on 15 November 2017, over 7 years ago
Updated 16 May 2025, about 2 months ago

As the title states.
The following $db->select(.., ..)->condition($q->orConditionGroup()); will generate an empty WHERE clause in the query.

I've stumbled upon this when creating a computed field with no schema that for which later it was requested the countFieldData().

🐛 Bug report
Status

Needs work

Version

11.0 🔥

Component

database system

Created by

🇷🇴Romania _Archy_

Live updates comments and jobs are added and updated live.
Sign in to follow issues

Comments & Activities

Not all content is available!

It's likely this issue predates Contrib.social: some issue and comment data are missing.

  • 🇬🇧United Kingdom dahousecat

    Patch #37 didn't apply for me.

    I'm hitting this bug by trying to edit a computed field with no schema.

    I've created a very simple patch that just checks if there are any columns before creating any applying the orConditionGroup.

Production build 0.71.5 2024