I am looking to maintain a full audit trail of user actions through the events table. However, I noticed that nothing is published to the events table when a query is saved. This would become a problem if a user were to edit a query and save it without executing or publishing the query. In this case, it seems like there would be no way of knowing who changed the query or what it was changed to.

The following solution mentions that there should be some “save query” events in the events table but I do not see any: How to subscribe query changes?

Does this logging already exist somewhere else? If not, are there any suggestions for logging saved queries and logging what they were saved to?

This is correct. The current source code does not record an event in this case.

Logging save actions would be easy enough. Just add a record_event call to the query update handler. Recording the change contents themselves seems like the wrong idea, since the events table would then be a form of (very inefficient) change tracking. For example, if a user changes one line of a 1k line query, 2k lines would be injected on the events table (rather than the just the diff).

Thank you, that makes sense. I will look into adding a record_event.

If I did want to include change tracking for all saved queries, do you suggest creating a new table instead?