Re: New buildin function
От | Stephan Szabo |
---|---|
Тема | Re: New buildin function |
Дата | |
Msg-id | 20030128220655.Q4312-100000@megazone23.bigpanda.com обсуждение исходный текст |
Ответ на | New buildin function (Olleg Samoylov <olleg@jane.telecom.mipt.ru>) |
Список | 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 по дате отправления: