Re: New buildin function - Mailing list pgsql-hackers

From Stephan Szabo
Subject Re: New buildin function
Date
Msg-id 20030128220655.Q4312-100000@megazone23.bigpanda.com
Whole thread Raw
In response to New buildin function  (Olleg Samoylov <olleg@jane.telecom.mipt.ru>)
List 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.



pgsql-hackers by date:

Previous
From: "Shridhar Daithankar"
Date:
Subject: Re: [ADMIN] Cannot connect to the database (PG 7.3)
Next
From: Tom Lane
Date:
Subject: Re: Can we revisit the thought of PostgreSQL 7.2.4?