# HG changeset patch # User Alain Mazy # Date 1768477045 -3600 # Node ID 048240f671d286791a2013f7cdeb2e7b45c7e90c # Parent 7c9283094555df2b504b3861f5284424d3b5fe3f tools/find: filtering against 'LabelsConstraint': 'None' with an empty list of 'Labels' now returns all resources that do not have any labels attached instead of returning all resources diff -r 7c9283094555 -r 048240f671d2 Framework/Plugins/ISqlLookupFormatter.cpp --- a/Framework/Plugins/ISqlLookupFormatter.cpp Thu Jan 15 12:36:53 2026 +0100 +++ b/Framework/Plugins/ISqlLookupFormatter.cpp Thu Jan 15 12:37:25 2026 +0100 @@ -811,6 +811,10 @@ where.push_back("(SELECT COUNT(1) FROM Labels AS selectedLabels WHERE selectedLabels.id = " + FormatLevel(queryLevel) + ".internalId AND selectedLabels.label IN (" + Join(formattedLabels, "", ", ") + ")) " + condition); } + else if (labelsConstraint == LabelsConstraint_None) // from 1.12.11, 'None' with an empty labels list means "list all resources without any labels" + { + where.push_back("(SELECT COUNT(1) FROM Labels WHERE id = " + FormatLevel(queryLevel) + ".internalId) = 0"); + } sql += joins + Join(where, " WHERE ", " AND "); @@ -1126,6 +1130,10 @@ where.push_back("(SELECT COUNT(1) FROM Labels AS selectedLabels WHERE selectedLabels.id = " + strQueryLevel + ".internalId AND selectedLabels.label IN (" + Join(formattedLabels, "", ", ") + ")) " + condition); } + else if (request.labels_constraint() == LabelsConstraint_None) // from 1.12.11, 'None' with an empty labels list means "list all resources without any labels" + { + where.push_back("(SELECT COUNT(1) FROM Labels WHERE id = " + FormatLevel(queryLevel) + ".internalId) = 0"); + } sql += joins + orderingJoins + Join(where, " WHERE ", " AND "); @@ -1245,6 +1253,11 @@ ") AS temp " " WHERE labelsCount " + condition + ")"); } + else if (labelsConstraint == LabelsConstraint_None) // from 1.12.11, 'None' with an empty labels list means "list all resources without any labels" + { + sql += (" AND (SELECT COUNT(1) FROM Labels WHERE id = internalId) = 0"); + } + if (limit != 0) { diff -r 7c9283094555 -r 048240f671d2 PostgreSQL/NEWS --- a/PostgreSQL/NEWS Thu Jan 15 12:36:53 2026 +0100 +++ b/PostgreSQL/NEWS Thu Jan 15 12:37:25 2026 +0100 @@ -1,3 +1,11 @@ +Pending changes in the mainline +=============================== + +Changes: +* In tools/find, filtering against "LabelsConstraint": "None" with an empty "Labels" list + now returns all resources that do not have any labels attached instead of returning all resources. + + Release 10.0 (2025-12-02) =========================