pg.ddx.io  pgsql-docs@postgresql.org mailing list archive  
help / color / mirror / Atom feed
proposed FAQ entry
5+ messages / 4 participants
[nested] [flat]

* proposed FAQ entry
@ 2007-06-23 00:48 David Gardner <david@gardnerit.net>
  2007-06-29 01:06 ` Re: proposed FAQ entry Bruce Momjian <bruce@momjian.us>
  0 siblings, 1 reply; 5+ messages in thread

From: David Gardner @ 2007-06-23 00:48 UTC (permalink / raw)
  To: pgsql-docs

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.



^ permalink  raw  reply  [nested|flat] 5+ messages in thread

* Re: proposed FAQ entry
  2007-06-23 00:48 proposed FAQ entry David Gardner <david@gardnerit.net>
@ 2007-06-29 01:06 ` Bruce Momjian <bruce@momjian.us>
  2007-06-29 01:34   ` Re: proposed FAQ entry Alvaro Herrera <alvherre@commandprompt.com>
  2007-06-29 07:55   ` Re: proposed FAQ entry Magnus Hagander <magnus@hagander.net>
  0 siblings, 2 replies; 5+ messages in thread

From: Bruce Momjian @ 2007-06-29 01:06 UTC (permalink / raw)
  To: David Gardner <david@gardnerit.net>; +Cc: pgsql-docs

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.

-- 
  Bruce Momjian  <bruce@momjian.us>          http://momjian.us
  EnterpriseDB                               http://www.enterprisedb.com

  + If your life is a hard drive, Christ can be your backup. +



^ permalink  raw  reply  [nested|flat] 5+ messages in thread

* Re: proposed FAQ entry
  2007-06-23 00:48 proposed FAQ entry David Gardner <david@gardnerit.net>
  2007-06-29 01:06 ` Re: proposed FAQ entry Bruce Momjian <bruce@momjian.us>
@ 2007-06-29 01:34   ` Alvaro Herrera <alvherre@commandprompt.com>
  1 sibling, 0 replies; 5+ messages in thread

From: Alvaro Herrera @ 2007-06-29 01:34 UTC (permalink / raw)
  To: Bruce Momjian <bruce@momjian.us>; +Cc: David Gardner <david@gardnerit.net>; pgsql-docs

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.

Hmm, I do see it from time to time in pgsql-es-ayuda.  Maybe not as
frequently as some other questions that are also missing from the FAQ
(like a thorough explanation of encoding issues), but I digress.

-- 
Alvaro Herrera                               http://www.PlanetPostgreSQL.org/
"Ni aun el genio muy grande llegaría muy lejos
si tuviera que sacarlo todo de su propio interior" (Goethe)



^ permalink  raw  reply  [nested|flat] 5+ messages in thread

* Re: proposed FAQ entry
  2007-06-23 00:48 proposed FAQ entry David Gardner <david@gardnerit.net>
  2007-06-29 01:06 ` Re: proposed FAQ entry Bruce Momjian <bruce@momjian.us>
@ 2007-06-29 07:55   ` Magnus Hagander <magnus@hagander.net>
  2007-06-29 13:45     ` Re: proposed FAQ entry David Gardner <david@gardnerit.net>
  1 sibling, 1 reply; 5+ messages in thread

From: Magnus Hagander @ 2007-06-29 07:55 UTC (permalink / raw)
  To: Bruce Momjian <bruce@momjian.us>; +Cc: David Gardner <david@gardnerit.net>; pgsql-docs

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



^ permalink  raw  reply  [nested|flat] 5+ messages in thread

* Re: proposed FAQ entry
  2007-06-23 00:48 proposed FAQ entry David Gardner <david@gardnerit.net>
  2007-06-29 01:06 ` Re: proposed FAQ entry Bruce Momjian <bruce@momjian.us>
  2007-06-29 07:55   ` Re: proposed FAQ entry Magnus Hagander <magnus@hagander.net>
@ 2007-06-29 13:45     ` David Gardner <david@gardnerit.net>
  0 siblings, 0 replies; 5+ messages in thread

From: David Gardner @ 2007-06-29 13:45 UTC (permalink / raw)
  To: 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



^ permalink  raw  reply  [nested|flat] 5+ messages in thread


end of thread, other threads:[~2007-06-29 13:45 UTC | newest]

Thread overview: 5+ messages (download: mbox mbox.gz follow: Atom feed)
-- links below jump to the message on this page --
2007-06-23 00:48 proposed FAQ entry David Gardner <david@gardnerit.net>
2007-06-29 01:06 ` Bruce Momjian <bruce@momjian.us>
2007-06-29 01:34   ` Alvaro Herrera <alvherre@commandprompt.com>
2007-06-29 07:55   ` Magnus Hagander <magnus@hagander.net>
2007-06-29 13:45     ` David Gardner <david@gardnerit.net>

This inbox is served by DDX for PostgreSQL; see mirroring instructions
for how to clone and mirror all data and code used for this inbox