Re: [GENERAL] auditing in postgresql

2007-08-31 Thread Jeff Davis
On Thu, 2007-08-30 at 21:43 -0400, Merlin Moncure wrote: Well, a SRF may be unsuitable for various reasons, but maybe views are better. I really like views more and more lately (better than functions as a rule, I think). you have some query, select yadda create view log_yadda as select

Re: [GENERAL] auditing in postgresql

2007-08-31 Thread Jeff Davis
On Fri, 2007-08-31 at 13:51 -0400, Merlin Moncure wrote: how about this: create view log_yadda sa select yadda where (select func()); the parens around the function call force it to be evaluated as a scalar. if you declare func() immutable, you can (maybe) remove the parens because

Re: [GENERAL] auditing in postgresql

2007-08-31 Thread Merlin Moncure
On 8/31/07, Jeff Davis [EMAIL PROTECTED] wrote: On Fri, 2007-08-31 at 13:51 -0400, Merlin Moncure wrote: how about this: create view log_yadda sa select yadda where (select func()); the parens around the function call force it to be evaluated as a scalar. if you declare

Re: [GENERAL] auditing in postgresql

2007-08-31 Thread Tom Lane
Merlin Moncure [EMAIL PROTECTED] writes: At present, immutable functions are only treated as constants during a query, which is what we want (no problems with prepare). Uh, no, they'd be folded to constants at plan time, which is exactly what Jeff doesn't want AFAICS. The subselect trick is a

Re: [GENERAL] auditing in postgresql

2007-08-31 Thread Merlin Moncure
On 8/31/07, Tom Lane [EMAIL PROTECTED] wrote: Merlin Moncure [EMAIL PROTECTED] writes: At present, immutable functions are only treated as constants during a query, which is what we want (no problems with prepare). Uh, no, they'd be folded to constants at plan time, which is exactly what

Re: [GENERAL] auditing in postgresql

2007-08-31 Thread Merlin Moncure
On 8/31/07, Jeff Davis [EMAIL PROTECTED] wrote: On Thu, 2007-08-30 at 21:43 -0400, Merlin Moncure wrote: Well, a SRF may be unsuitable for various reasons, but maybe views are better. I really like views more and more lately (better than functions as a rule, I think). you have some

Re: [GENERAL] auditing in postgresql

2007-08-31 Thread Merlin Moncure
On 8/31/07, Merlin Moncure [EMAIL PROTECTED] wrote: On 8/31/07, Jeff Davis [EMAIL PROTECTED] wrote: On Thu, 2007-08-30 at 21:43 -0400, Merlin Moncure wrote: Well, a SRF may be unsuitable for various reasons, but maybe views are better. I really like views more and more lately (better than

Re: [GENERAL] auditing in postgresql

2007-08-31 Thread Jeff Davis
On Fri, 2007-08-31 at 16:42 -0400, Merlin Moncure wrote: On 8/31/07, Tom Lane [EMAIL PROTECTED] wrote: Merlin Moncure [EMAIL PROTECTED] writes: At present, immutable functions are only treated as constants during a query, which is what we want (no problems with prepare). Uh, no,

[GENERAL] auditing in postgresql

2007-08-30 Thread Jeff Davis
I know already it's possible to audit changes to data in postgresql tables using triggers, etc. A lot of other things can also be logged using the logging mechanism, such as permission errors (by logging all error messages), etc. However, there are also other things that would be useful to

Re: [GENERAL] auditing in postgresql

2007-08-30 Thread Jeff Davis
On Thu, 2007-08-30 at 15:39 -0600, Guy Fraser wrote: Below is the logging section from the postgresql.conf file. It would appear that you can configure PostgreSQL to log as much detail as you want to where you want. You can then write a program to parse the log file and present the

Re: [GENERAL] auditing in postgresql

2007-08-30 Thread Merlin Moncure
On 8/30/07, Jeff Davis [EMAIL PROTECTED] wrote: I know already it's possible to audit changes to data in postgresql tables using triggers, etc. A lot of other things can also be logged using the logging mechanism, such as permission errors (by logging all error messages), etc. However,