From: | Stephan Szabo <sszabo(at)megazone23(dot)bigpanda(dot)com> |
---|---|
To: | Olleg Samoylov <olleg(at)jane(dot)telecom(dot)mipt(dot)ru> |
Cc: | PostgreSQL Development <pgsql-hackers(at)postgresql(dot)org> |
Subject: | Re: New buildin function |
Date: | 2003-01-29 06:12:01 |
Message-ID: | 20030128220655.Q4312-100000@megazone23.bigpanda.com |
Views: | Raw Message | Whole Thread | Download mbox | Resend email |
Thread: | |
Lists: | pgsql-hackers |
On Fri, 24 Jan 2003, Olleg Samoylov wrote:
> On 23 Jan 2003, Rod Taylor wrote:
> Nope. CURRENT_USER and SESSION_USER return username. Sometimes need uid,
> it's key usesysid in table pg_shadow, for instance, for row based
> permissions. Explain in example:
>
> create table role {
> role smallinteger, -- analog group of users
> name text
> }
>
> create table permission { -- link role with pg_user
> uid integer references pg_user(usesysid),
> role smallint references role
> }
>
> create table protected_table {
> -- payload fields
> access smallint references role,
> author_of_last_changes integer references pg_user(usesysid) default
> PG_SESSION_UID(), -- proposed function
> time_of_last_changes timestamp not null default current_timestamp
> }
As a side note, the above table definitions are pretty invalid.
Referencing system tables is not guaranteed to work, and referencing
system views even less so.
From | Date | Subject | |
---|---|---|---|
Next Message | Shridhar Daithankar<shridhar_daithankar@persistent.co.in> | 2003-01-29 06:22:06 | Re: [ADMIN] Cannot connect to the database (PG 7.3) |
Previous Message | Neil Conway | 2003-01-29 05:46:42 | Re: Request for qualified column names |