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

dbReadProfile finds filters by matching on filter.id in the database, but dbAddRuleFilter stores the ruleId in filter.rule #255

Open
frereit opened this issue Sep 1, 2024 · 0 comments
Labels
bug Something isn't working

Comments

@frereit
Copy link
Collaborator

frereit commented Sep 1, 2024

When using --import-data (and possible other code paths leading to dbAddRuleFilter), the rule id this filter belongs to is stored in the rule field of the filter table:

_, err = db.Exec(
`INSERT INTO filter (rule, type, parameters) VALUES ($1, $2, $3) RETURNING id`,
ruleId, filterType, parametersJson)

However, when retrieving a rule, only filters where the id of the filter in the database matches the rule are returned:

var dbFilters []dbFilter
err = db.Select(&dbFilters, "SELECT type, parameters FROM filter WHERE id = $1", dbRule.Id)

This mismatch causes at least --import-data to fail. Simply changing the SELECT statement to match on rule = $1 instead works, but I'm unsure if this doesn't break other parts of the codebase which store the rule id in the id field of filter.

@frereit frereit added the bug Something isn't working label Sep 1, 2024
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
bug Something isn't working
Projects
None yet
Development

No branches or pull requests

1 participant