Logging access to data in database table

Поиск
Список
Период
Сортировка
От Ivan Radovanovic
Тема Logging access to data in database table
Дата
Msg-id 4F1FF5B9.2020409@gmail.com
обсуждение исходный текст
Ответы Re: Logging access to data in database table  ("Greg Sabino Mullane" <greg@turnstep.com>)
Re: Logging access to data in database table  (Misa Simic <misa.simic@gmail.com>)
Список pgsql-general
Hello,

I need to log access to certain data in database in some log (I prefer
to have that both in syslog and table in database), and I find it easy
to write to syslog, but I can't solve the problem of writing this to
database table.

If this protected data is read only using postgres function , and if in
the same function I add something like "insert into log_table (blah blah
blah)", somebody could simply do
begin;
select * from access_function(); /* assuming access_function is function
for accessing sensitive data */
rollback;

and no info about access would be written in log_table.

Is there some way to enforce insert within function to be always
performed (I checked and commit can't be called within functions), or is
there maybe some completely different clever way to solve this problem?

Thanks in advance,
Ivan

В списке pgsql-general по дате отправления:

Предыдущее
От: Jason Armstrong
Дата:
Сообщение: Index on parent/child hierarchy
Следующее
От: Simon Riggs
Дата:
Сообщение: Re: Index on parent/child hierarchy