Received: from localhost (maia-3.hub.org [200.46.204.184]) by postgresql.org (Postfix) with ESMTP id 933F19FC274 for ; Fri, 29 Jun 2007 10:55:29 -0300 (ADT) Received: from postgresql.org ([200.46.204.71]) by localhost (mx1.hub.org [200.46.204.184]) (amavisd-maia, port 10024) with ESMTP id 77461-03 for ; Fri, 29 Jun 2007 10:55:14 -0300 (ADT) X-Greylist: delayed 00:05:01.133932 by SQLgrey-1.7.5 Received: from rwcrmhc15.comcast.net (rwcrmhc15.comcast.net [204.127.192.85]) by postgresql.org (Postfix) with ESMTP id 6D2C79FC2A8 for ; Fri, 29 Jun 2007 10:55:22 -0300 (ADT) Received: from monster.gardnerit.net (cpe-76-168-240-190.socal.res.rr.com[76.168.240.190]) by comcast.net (rwcrmhc15) with ESMTP id <20070629134532m15009eg27e>; Fri, 29 Jun 2007 13:45:36 +0000 Received: from localhost (monster [127.0.0.1]) by monster.gardnerit.net (Postfix) with ESMTP id 45246113261 for ; Fri, 29 Jun 2007 06:45:47 -0700 (PDT) X-Virus-Scanned: amavisd-new at gardnerit.net Received: from monster.gardnerit.net ([127.0.0.1]) by localhost (monster.gardnerit.net [127.0.0.1]) (amavisd-new, port 10024) with ESMTP id cwzEdCoBRJhy for ; Fri, 29 Jun 2007 06:45:45 -0700 (PDT) Received: from [192.168.1.144] (unknown [192.168.1.1]) (using TLSv1 with cipher DHE-RSA-AES256-SHA (256/256 bits)) (No client certificate requested) by monster.gardnerit.net (Postfix) with ESMTP id B628D1130ED for ; Fri, 29 Jun 2007 06:45:45 -0700 (PDT) Message-ID: <46850CF4.7050005@gardnerit.net> Date: Fri, 29 Jun 2007 06:45:24 -0700 From: David Gardner User-Agent: Thunderbird 2.0.0.4 (Macintosh/20070604) MIME-Version: 1.0 To: pgsql-docs@postgresql.org Subject: Re: proposed FAQ entry References: <467C6DD9.3090407@gardnerit.net> <200706290106.l5T16KU18798@momjian.us> <20070629075509.GC20255@svr2.hagander.net> In-Reply-To: <20070629075509.GC20255@svr2.hagander.net> Content-Type: text/plain; charset=ISO-8859-1; format=flowed Content-Transfer-Encoding: 7bit X-Virus-Scanned: Maia Mailguard 1.0.1 X-Archive-Number: 200706/28 X-Sequence-Number: 4317 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