Re: [GENERAL] Suggested way of associating PG user metadata with record

2009-05-20 Thread Peter Geoghegan
David, > A text column should be perfectly fine, and is the simplest > implementation. But it does have a few possible issues that you need > to keep in mind (besides things like users being removed). For > instance, if PostgreSQL users are renamed (eg: ALTER USER name RENAME > TO newname), then y

Re: [GENERAL] Suggested way of associating PG user metadata with record

2009-05-20 Thread David
>> >> That said, you could also use the value in pg_user.usesysid as a >> unique ID, rather than the account name (if you want to distinguish >> between different users with the same login name, over a period of >> time where users were removed and re-added). > > Perhaps I should just not use a for

Re: [GENERAL] Suggested way of associating PG user metadata with record

2009-05-20 Thread Peter Geoghegan
David, > You should be careful about linking records to PostgreSQL user > accounts. If the PostgreSQL accounts are removed, there could be > problems with the foreign key references, if you don't implement it > carefully. > > That said, you could also use the value in pg_user.usesysid as a > uniqu

Re: [GENERAL] Suggested way of associating PG user metadata with record

2009-05-20 Thread David
On Wed, May 20, 2009 at 12:28 PM, Peter Geoghegan wrote: > Hello, > > I'd like to associate the PG user who created certain sorts of records > with that record in my application. The obvious way to do this is by > creating a text column with a default value of current_user in the > record's table,

[GENERAL] Suggested way of associating PG user metadata with record

2009-05-20 Thread Peter Geoghegan
Hello, I'd like to associate the PG user who created certain sorts of records with that record in my application. The obvious way to do this is by creating a text column with a default value of current_user in the record's table, or perhaps something similar with a trigger. However, because what I