Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

chore: remove duplicates in related_changes_recursive #1189

Merged
merged 1 commit into from
Nov 11, 2024
Merged
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
8 changes: 4 additions & 4 deletions views/006_config_views.sql
Original file line number Diff line number Diff line change
Expand Up @@ -788,7 +788,7 @@ BEGIN

ELSIF type_filter IN ('downstream') THEN
RETURN query
SELECT
SELECT DISTINCT ON (cc.id)
cc.id, cc.config_id, config_items.name, config_items.type, config_items.tags, cc.external_created_by,
cc.created_at, cc.severity, cc.change_type, cc.source, cc.summary, cc.created_by, cc.count, cc.first_observed, config_items.agent_id
FROM config_changes cc
Expand All @@ -798,19 +798,19 @@ BEGIN
FROM config_relationships
WHERE relation != 'hard') AS cr
ON (cr.config_id = cc.config_id OR (soft AND cr.related_id = cc.config_id))
WHERE starts_with(config_items.path, (
WHERE config_items.path LIKE (
SELECT CASE
WHEN config_items.path = '' THEN config_items.id::text
ELSE CONCAT(config_items.path, '.', config_items.id)
END
FROM config_items WHERE config_items.id = lookup_id
)) OR
) || '%' OR
(cc.config_id = lookup_id) OR
(soft AND (cr.config_id = lookup_id OR cr.related_id = lookup_id));

ELSIF type_filter IN ('upstream') THEN
RETURN query
SELECT
SELECT DISTINCT ON (cc.id)
cc.id, cc.config_id, config_items.name, config_items.type, config_items.tags, cc.external_created_by,
cc.created_at, cc.severity, cc.change_type, cc.source, cc.summary, cc.created_by, cc.count, cc.first_observed, config_items.agent_id
FROM config_changes cc
Expand Down
Loading