Skip to content

Comments

Fix PropertyEq for multiple properties and improve query performance#171

Merged
allburov merged 1 commit intodevopshq:masterfrom
christianwaldmann:simplify-propertyeq
Jan 26, 2026
Merged

Fix PropertyEq for multiple properties and improve query performance#171
allburov merged 1 commit intodevopshq:masterfrom
christianwaldmann:simplify-propertyeq

Conversation

@christianwaldmann
Copy link
Contributor

What does this PR do?

  • fix incorrect behavior of the PropertyEq rule when artifacts have multiple properties
  • simplify the generated AQL/SQL to improve performance

Motivation

The current PropertyEq implementation checks the property key and value in separate conditions. This can produce false positives when an artifact has multiple properties, because the key and value may match different properties instead of the same one.

By using Artifactory’s @ property syntax, the rule ensures the key and value belong to the same property and generates a single condition, improving correctness and performance.

Example

Rule:

- rule: PropertyEq
  property_key: my-test-property
  property_value: 100

Current SQL (incorrect for multiple properties):

AND (
    EXISTS (
        SELECT 1
        FROM node_props npsub
        WHERE npsub.node_id = n.node_id
        AND npsub.prop_key = 'my-test-property'
    )
)
AND (
    EXISTS (
        SELECT 1
        FROM node_props npsub
        WHERE npsub.node_id = n.node_id
        AND npsub.prop_value = '100'
    )
)
…

New SQL (correct and faster):

AND (
    EXISTS (
        SELECT 1
        FROM node_props npsub
        WHERE npsub.node_id = n.node_id
        AND npsub.prop_key = 'my-test-property'
        AND npsub.prop_value = '100'
    )
)
…

@christianwaldmann christianwaldmann marked this pull request as ready for review January 14, 2026 15:41
@christianwaldmann
Copy link
Contributor Author

@allburov Can you have a look at this PR please?

@allburov allburov merged commit 65a9c2f into devopshq:master Jan 26, 2026
2 checks passed
@christianwaldmann christianwaldmann deleted the simplify-propertyeq branch January 26, 2026 10:13
@christianwaldmann
Copy link
Contributor Author

@allburov Thanks for the fast merge! Can you also create a new release?

@christianwaldmann
Copy link
Contributor Author

hi @allburov, just following up on the new release. I opened #172 to bump the version - would be great if you could take a look when you have a chance. Thanks!

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Development

Successfully merging this pull request may close these issues.

2 participants