*** auto_explain.c	Wed Feb 17 10:59:20 2010
--- auto_explain.fix.c	Wed Feb 17 13:49:42 2010
***************
*** 12,17 ****
--- 12,18 ----
   */
  #include "postgres.h"
  
+ #include "access/xact.h"
  #include "commands/explain.h"
  #include "executor/instrument.h"
  #include "utils/guc.h"
*************** static ExecutorEnd_hook_type prev_Execut
*** 44,50 ****
  
  #define auto_explain_enabled() \
  	(auto_explain_log_min_duration >= 0 && \
! 	 (nesting_level == 0 || auto_explain_log_nested_statements))
  
  void		_PG_init(void);
  void		_PG_fini(void);
--- 45,52 ----
  
  #define auto_explain_enabled() \
  	(auto_explain_log_min_duration >= 0 && \
! 	 (nesting_level == 0 || auto_explain_log_nested_statements) && \
! 	 TransactionBlockStatusCode() == 'T')
  
  void		_PG_init(void);
  void		_PG_fini(void);
