Re: proposed FAQ entry

From: David Gardner <david(at)gardnerit(dot)net>
To: pgsql-docs(at)postgresql(dot)org
Subject: Re: proposed FAQ entry
Date: 2007-06-29 13:45:24
Message-ID: 46850CF4.7050005@gardnerit.net
Views: Raw Message | Whole Thread | Download mbox | Resend email
Thread:
Lists: pgsql-docs

Well the motivation for the question, is to want to track edits to the
database. To know who changed what/when, and possibly run a report
against that information. I looked through the docs to find the user and
session_user variables at:
http://www.postgresql.org/docs/8.1/interactive/functions-info.html

It just seemed natural to think there must be some kind of integer key
associated with the user. Maybe this doesn't qualify as frequent.

Magnus Hagander wrote:
> On Thu, Jun 28, 2007 at 09:06:20PM -0400, Bruce Momjian wrote:
>> David Gardner wrote:
>>> Earlier today I was tempted to start storing usesysid's as foreign keys
>>> in one of my tables by doing:
>>> SELECT usesysid FROM pg_user WHERE pg_user.usename= user;
>>>
>>> My proposed FAQ entry is based on this mailing list post which convinced
>>> me not to:
>>> http://archives.postgresql.org/pgsql-novice/2005-04/msg00328.php
>>>
>>>
>>> So the Question would be:
>>>
>>> Q) How do I keep track of edits to a table? OR Can I use store usesysid
>>> in my table to identify users?
>>>
>>> A) No because usesysid values are not guaranteed to remain the same
>>> after a restore, or upgrade. Instead store the user name as text, if
>>> needed create your own user table and associate the user names with
>>> integer keys.
>> Uh, sorry, this is not a _frequent_ question/issue.
>
> If it's not frequent, perhaps it should at least go in the documentatino
> somewhere?
>
> (I confess I haven't checked if it's actually there already)
>
> //Magnus
>
> ---------------------------(end of broadcast)---------------------------
> TIP 3: Have you checked our extensive FAQ?
>
> http://www.postgresql.org/docs/faq

--
David Gardner

In response to

Browse pgsql-docs by date

  From Date Subject
Next Message David Fetter 2007-06-29 18:32:19 Re: rename of a view
Previous Message Magnus Hagander 2007-06-29 07:55:09 Re: proposed FAQ entry