pg.ddx.io  pgsql-bugs@postgresql.org mailing list archive  
help / color / mirror / Atom feed
BUG #10989: log_statement = ddl does not log ddl statements from stored functions
2+ messages / 2 participants
[nested] [flat]

* BUG #10989: log_statement = ddl does not log ddl statements from stored functions
@ 2014-07-18 12:29 eshkinkot@gmail.com
  2014-07-20 05:57 ` Re: BUG #10989: log_statement = ddl does not log ddl statements from stored functions Amit Kapila <amit.kapila16@gmail.com>
  0 siblings, 1 reply; 2+ messages in thread

From: eshkinkot@gmail.com @ 2014-07-18 12:29 UTC (permalink / raw)
  To: pgsql-bugs

The following bug has been logged on the website:

Bug reference:      10989
Logged by:          Sergey Burladyan
Email address:      eshkinkot@gmail.com
PostgreSQL version: 9.3.4
Operating system:   Debian testing
Description:        

If I run DROP directly, it logged:
drop view test_view ;
2014-07-18 16:20:51 MSK LOG:  statement: drop view test_view ;

but this query is not:
do $$ begin execute 'drop view test_view'; end $$;


-- 
Sent via pgsql-bugs mailing list (pgsql-bugs@postgresql.org)
To make changes to your subscription:
http://www.postgresql.org/mailpref/pgsql-bugs



^ permalink  raw  reply  [nested|flat] 2+ messages in thread

* Re: BUG #10989: log_statement = ddl does not log ddl statements from stored functions
  2014-07-18 12:29 BUG #10989: log_statement = ddl does not log ddl statements from stored functions eshkinkot@gmail.com
@ 2014-07-20 05:57 ` Amit Kapila <amit.kapila16@gmail.com>
  0 siblings, 0 replies; 2+ messages in thread

From: Amit Kapila @ 2014-07-20 05:57 UTC (permalink / raw)
  To: eshkinkot@gmail.com; +Cc: pgsql-bugs

On Fri, Jul 18, 2014 at 5:59 PM, <eshkinkot@gmail.com> wrote:
>
> The following bug has been logged on the website:
>
> Bug reference:      10989
> Logged by:          Sergey Burladyan
> Email address:      eshkinkot@gmail.com
> PostgreSQL version: 9.3.4
> Operating system:   Debian testing
> Description:
>
> If I run DROP directly, it logged:
> drop view test_view ;
> 2014-07-18 16:20:51 MSK LOG:  statement: drop view test_view ;
>
> but this query is not:
> do $ begin execute 'drop view test_view'; end $;

The reason for not logging this statement is that as per current design
postgres only logs top level statements that get executed with
log_statement settings.

Example:
1. Create table t1(c1 int, c2 char(30));

2.
CREATE OR REPLACE FUNCTION test_func() RETURNS int AS
$BODY$
DECLARE
    r int;
BEGIN
    FOR r IN 1 .. 10
    LOOP
        insert into t1 values(1,'aaa');
        update t1 set c1=10;
        delete from t1;
    END LOOP;
    RETURN 1;
END
$BODY$
LANGUAGE plpgsql;

3. Change log_statement = 'all'

4. Execute the function:
select test_func();

Now the result will be that in logs you will just see 'select test_func();'.

I think this is not a bug, rather if you want such functionality, this will
be a new feature in itself "log statements executed as part of function
execution" for which if there is a good use case then we need to discuss
it on -hackers (pgsql-hackers(at)postgresql(dot)org) mailing list.


With Regards,
Amit Kapila.
EnterpriseDB: http://www.enterprisedb.com

^ permalink  raw  reply  [nested|flat] 2+ messages in thread


end of thread, other threads:[~2014-07-20 05:57 UTC | newest]

Thread overview: 2+ messages (download: mbox mbox.gz follow: Atom feed)
-- links below jump to the message on this page --
2014-07-18 12:29 BUG #10989: log_statement = ddl does not log ddl statements from stored functions eshkinkot@gmail.com
2014-07-20 05:57 ` Amit Kapila <amit.kapila16@gmail.com>

This inbox is served by DDX for PostgreSQL; see mirroring instructions
for how to clone and mirror all data and code used for this inbox