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

Empty Entries With Black Listing #53

Closed
economysizegeek opened this issue Jan 2, 2018 · 5 comments
Closed

Empty Entries With Black Listing #53

economysizegeek opened this issue Jan 2, 2018 · 5 comments
Labels

Comments

@economysizegeek
Copy link

I track a position in a list and the status of data display in a table row.

execute <<-SQL CREATE TRIGGER logidze_on_brokerage_transactions BEFORE UPDATE OR INSERT ON brokerage_transactions FOR EACH ROW WHEN (coalesce(#{current_setting('logidze.disabled')}, '') <> 'on') EXECUTE PROCEDURE logidze_logger(100, 'updated_at', '{created_at, position, stale}'); SQL

The position and stale get updated a lot - and they don't actually matter to the audit. I ended up with a bunch of records that just have the updated_at as the changed field. I then change it to:
EXECUTE PROCEDURE logidze_logger(100, '', '{created_at, position, updated_at, stale}');

Now I have a bunch of change entries with no entries in them. Basically I'm trying to only store changes if there is a change in a field that isn't created_at, position or stale. What should it look like?

@palkan
Copy link
Owner

palkan commented Jan 3, 2018

I then change it to:
EXECUTE PROCEDURE logidze_logger(100, '', '{created_at, position, updated_at, stale}');

Looks good to me. Except from the second argument: it should be either 'updated_at' (if you want to use updated_at column value as a log timestamp) or null (if you want to rely on DB current time as a log timestamp).

Now I have a bunch of change entries with no entries in them.

Looks like a bug: if everything is filtered out we still add a log entry. @charlie-wasp Could you, please, take a look?

@palkan palkan added the bug label Jan 3, 2018
@economysizegeek
Copy link
Author

  1. So should I change it to this:
    EXECUTE PROCEDURE logidze_logger(100, null, '{created_at, position, updated_at, stale}');
  2. Let me know if there is anything I can contribute to help sort the problem. I assumed I was just doing something wrong :) I want to track most changes but not all of them.

@economysizegeek
Copy link
Author

I made the null change and it it still generating empty change versions.

{"c"=>{}, "v"=>2, "ts"=>1514993038238}, {"c"=>{}, "v"=>3, "ts"=>1514993038268}, {"c"=>{"closed_at"=>"2018-03-03 15:24:52.146939"}, "v"=>4, "ts"=>1514993094375}, {"c"=>{}, "v"=>5, "ts"=>1514993100172}, {"c"=>{}, "v"=>6, "ts"=>1514993100204}], "v"=>6}

@charlie-wasp
Copy link
Collaborator

@palkan I‘m on it!

@palkan
Copy link
Owner

palkan commented Jan 11, 2018

Fixed by #55 and released as 0.6.2

@palkan palkan closed this as completed Jan 11, 2018
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
Projects
None yet
Development

No branches or pull requests

3 participants