Skip site navigation (1) Skip section navigation (2)

Logging access to data in database table

From: Ivan Radovanovic <radovanovic(at)gmail(dot)com>
To: pgsql-general(at)postgresql(dot)org
Subject: Logging access to data in database table
Date: 2012-01-25 12:29:45
Message-ID: (view raw, whole thread or download thread mbox)
Lists: pgsql-general

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
select * from access_function(); /* assuming access_function is function 
for accessing sensitive data */

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,


pgsql-general by date

Next:From: panamDate: 2012-01-25 15:12:18
Subject: Re: Best way to create unique primary keys across schemas?
Previous:From: Simon RiggsDate: 2012-01-25 12:14:14
Subject: Re: Index on parent/child hierarchy

Privacy Policy | About PostgreSQL
Copyright © 1996-2017 The PostgreSQL Global Development Group