Hello!
Please give me your advices about the best way to keep in each table those informations:
name of the user who created a row
name of the last user who modified it
timestamp for creation
timestamp for last modification
1/ I have been looking for built in options in postgres but I guess I have to build it myself...?
Of course if Postgres already does it I am very happy, and all of the following quetsions are useless but I did not find this in the documentation...
2/ Is there some SQL query to return the "usermane" from pg_catalog or something
(I will manage access to the database giving every user a role in his name, those role belonging to group roles such as senior/junior/visitor...) I did not find this in the documentation.
Or, even if it exists, maybe I would better get it back from some user table such as
CREATE TABLE users (username TEXT, role TEXT, id_user..); ??
for timestamps, I guess triggers would be the best way to do the job, but I would like to have the whole table updated automatically without having to include this in all my update quieries...
3/ once such a table is built like this for example
CREATE TABLE track (creation TIMESTAMP, last_modification TIMESTAMP, created_by TEXT, lastmodified_by TEXT)
What would be the advantages and drawbacks of this :
CREATE TABLE anytable(...) INHERITS (tracks)
vs this: CREATE TABLE anytable (...) LIKE tracks?
Many thanks for your help!