First, thank you for this excellent extension!
I have noticed that the versioning trigger creates new history rows even if they are the same as the previous one. I mean, if I execute UPDATE myTable SET column = 2 WHERE id = 1 5 times - I will have 5 rows in the history differing only in the sys_period column.
I tried to wrap the versioning() function with an SQL trigger but I faced the errors function versioning(text, text, text) does not exist and function "versioning" was not called by trigger manager.
I am not familiar enough with PostgreSQL extensions API and can not modify the source code myself.
Maybe someone can help with this ?
UPDATE:
I created 2 triggers instead of one - first trigger handles INSERT and DELETE, second trigger handles UPDATE WHEN old.* IS DISTINCT FROM new.* but this does not solve the problem completely - for example if the history table has fewer columns than the original table and you update a column which is not present in the history table then you get extra rows in the history.
First, thank you for this excellent extension! I have noticed that the versioning trigger creates new history rows even if they are the same as the previous one. I mean, if I execute
UPDATE myTable SET column = 2 WHERE id = 1
5 times - I will have 5 rows in the history differing only in thesys_period
column. I tried to wrap the versioning() function with an SQL trigger but I faced the errorsfunction versioning(text, text, text) does not exist
andfunction "versioning" was not called by trigger manager
. I am not familiar enough with PostgreSQL extensions API and can not modify the source code myself. Maybe someone can help with this ? UPDATE: I created 2 triggers instead of one - first trigger handles INSERT and DELETE, second trigger handles UPDATEWHEN old.* IS DISTINCT FROM new.*
but this does not solve the problem completely - for example if the history table has fewer columns than the original table and you update a column which is not present in the history table then you get extra rows in the history.