Re: DDL & DML Logging doesn't work for calling functions

From: "Albe Laurenz" <laurenz(dot)albe(at)wien(dot)gv(dot)at>
To: MURAT KOÇ *EXTERN* <m(dot)koc21(at)gmail(dot)com>, <pgsql-general(at)postgresql(dot)org>
Subject: Re: DDL & DML Logging doesn't work for calling functions
Date: 2011-11-30 08:51:06
Message-ID: D960CB61B694CF459DCFB4B0128514C2072DF6D4@exadv11.host.magwien.gv.at
Views: Raw Message | Whole Thread | Download mbox | Resend email
Thread:
Lists: pgsql-general

MURAT KOÇ wrote:
> Version is PostgreSQL 9.0.4 on x86_64-unknown-linux-gnu, compiled by GCC gcc (GCC) 4.1.2 20080704 (Red
> Hat 4.1.2-51), 64-bit.
>
> We set logging parameters as below for DDL & DML Logging:
> logging_collector = on
> log_statement = mod
> log_line_prefix = '%t--%d--%u--%h--%a--%i--%e'

> Logging works successfully while we run direct DML commands like "insert, update, delete".
>
> But, when I call a function that does DML, logging doesn't work and server log file has no information
> about calling function.
>
> I call function like this: SELECT p_dummy_insert();
>
> ###This is sample insert function###
> CREATE OR REPLACE FUNCTION p_dummy_insert ()
> RETURNS void AS
> $BODY$
> BEGIN
> INSERT INTO employee values ('dummy', 'test');
> END$BODY$
> LANGUAGE plpgsql VOLATILE
> COST 100;
>
> "Not logging of function calls" is expected behavior or a bug? We have no information on server logs
> about who called function or when was it called or what did called function do?

The function call itself is logged, but SQL statements inside
the function are not.

The function call does not show up in your log because it is
in a SELECT statement.

Set log_statement = 'all' to log the function call.

Yours,
Laurenz Albe

In response to

Responses

Browse pgsql-general by date

  From Date Subject
Next Message Venkat Balaji 2011-11-30 09:04:27 : pg_compresslog (pglesslog)
Previous Message Albe Laurenz 2011-11-30 08:46:05 Re: odbc_fdw