8
8
*
9
9
*
10
10
* IDENTIFICATION
11
- * $PostgreSQL: pgsql/src/backend/tcop/postgres.c,v 1.515 2006/10/08 17:45:50 momjian Exp $
11
+ * $PostgreSQL: pgsql/src/backend/tcop/postgres.c,v 1.516 2006/10/19 19:52:22 tgl Exp $
12
12
*
13
13
* NOTES
14
14
* this is the "main" module of the postgres backend and
@@ -1326,9 +1326,9 @@ exec_bind_message(StringInfo input_message)
1326
1326
/*
1327
1327
* Report query to various monitoring facilities.
1328
1328
*/
1329
- debug_query_string = "bind message " ;
1329
+ debug_query_string = pstmt -> query_string ? pstmt -> query_string : "<BIND> " ;
1330
1330
1331
- pgstat_report_activity (pstmt -> query_string ? pstmt -> query_string : "<BIND>" );
1331
+ pgstat_report_activity (debug_query_string );
1332
1332
1333
1333
set_ps_display ("BIND" , false);
1334
1334
@@ -1680,37 +1680,17 @@ exec_execute_message(const char *portal_name, long max_rows)
1680
1680
return ;
1681
1681
}
1682
1682
1683
- /*
1684
- * Report query to various monitoring facilities.
1685
- */
1686
- debug_query_string = "execute message" ;
1687
-
1688
- pgstat_report_activity (portal -> sourceText ? portal -> sourceText : "<EXECUTE>" );
1689
-
1690
- set_ps_display (portal -> commandTag , false);
1691
-
1692
- if (save_log_statement_stats )
1693
- ResetUsage ();
1694
-
1695
1683
/* Does the portal contain a transaction command? */
1696
1684
is_xact_command = IsTransactionStmtList (portal -> parseTrees );
1697
1685
1698
- /*
1699
- * If we re-issue an Execute protocol request against an existing portal,
1700
- * then we are only fetching more rows rather than completely re-executing
1701
- * the query from the start. atStart is never reset for a v3 portal, so we
1702
- * are safe to use this check.
1703
- */
1704
- execute_is_fetch = !portal -> atStart ;
1705
-
1706
1686
/*
1707
1687
* We must copy the sourceText and prepStmtName into MessageContext in
1708
1688
* case the portal is destroyed during finish_xact_command. Can avoid the
1709
1689
* copy if it's not an xact command, though.
1710
1690
*/
1711
1691
if (is_xact_command )
1712
1692
{
1713
- sourceText = pstrdup (portal -> sourceText );
1693
+ sourceText = portal -> sourceText ? pstrdup (portal -> sourceText ) : NULL ;
1714
1694
if (portal -> prepStmtName )
1715
1695
prepStmtName = pstrdup (portal -> prepStmtName );
1716
1696
else
@@ -1732,6 +1712,18 @@ exec_execute_message(const char *portal_name, long max_rows)
1732
1712
portalParams = portal -> portalParams ;
1733
1713
}
1734
1714
1715
+ /*
1716
+ * Report query to various monitoring facilities.
1717
+ */
1718
+ debug_query_string = sourceText ? sourceText : "<EXECUTE>" ;
1719
+
1720
+ pgstat_report_activity (debug_query_string );
1721
+
1722
+ set_ps_display (portal -> commandTag , false);
1723
+
1724
+ if (save_log_statement_stats )
1725
+ ResetUsage ();
1726
+
1735
1727
BeginCommand (portal -> commandTag , dest );
1736
1728
1737
1729
/*
@@ -1746,6 +1738,14 @@ exec_execute_message(const char *portal_name, long max_rows)
1746
1738
*/
1747
1739
start_xact_command ();
1748
1740
1741
+ /*
1742
+ * If we re-issue an Execute protocol request against an existing portal,
1743
+ * then we are only fetching more rows rather than completely re-executing
1744
+ * the query from the start. atStart is never reset for a v3 portal, so we
1745
+ * are safe to use this check.
1746
+ */
1747
+ execute_is_fetch = !portal -> atStart ;
1748
+
1749
1749
/* Log immediately if dictated by log_statement */
1750
1750
if (check_log_statement_cooked (portal -> parseTrees ))
1751
1751
{
0 commit comments