This caught me today :
I switched on "log_statement=true" whilst examining a possible foreign
key concurrency problem. I noticed that the generated foreign key check
"SELECT 1 FROM ONLY ... WHERE id = ...FOR UPDATE..."
on the parent table seemed to be only appearing every now and again.
This caused some scratching of the head :-)
Finally light dawned (ok - after reading ri_triggers.c and querying
pg_locks) - that the backend saves the execution plan for the generated
statement, so it is only planned once...and I guess log_statement is
triggered in the plan stage somewhere...
So setting "log_statement=true" does all *statements* - but not all
*executions* of each statement. Is this the intention?
(BTW - I am using 7.4.1)
best wishes
Mark