From: | Romain Billon-Grand <billongrand(at)hotmail(dot)fr> |
---|---|
To: | Forum postgres debutants <pgsql-novice(at)postgresql(dot)org> |
Subject: | Keeping track of updates/performances |
Date: | 2015-03-17 08:06:35 |
Message-ID: | DUB124-W51DFD7A86003923BAF5160CE030@phx.gbl |
Views: | Raw Message | Whole Thread | Download mbox | Resend email |
Thread: | |
Lists: | pgsql-novice |
Hello!
Please give me your advices about the best way to keep in each table those informations:name of the user who created a rowname of the last user who modified ittimestamp for creationtimestamp 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 asCREATE 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 exampleCREATE 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!
From | Date | Subject | |
---|---|---|---|
Next Message | Andreas Kretschmer | 2015-03-17 08:50:56 | Re: Keeping track of updates/performances |
Previous Message | Luca Ferrari | 2015-03-16 17:23:37 | Re: psql sqlstate return code access |