diff options
| author | Tom Lane | 2009-01-02 20:42:00 +0000 |
|---|---|---|
| committer | Tom Lane | 2009-01-02 20:42:00 +0000 |
| commit | bbeb0bbf6b3e5fdb7cff1a87885f43139ace5c4b (patch) | |
| tree | 61f8c7f089cc1e35f20b76831bd388848c212799 /src/include | |
| parent | ccd31eb861e727671e4a771d4bcc37f1179caec9 (diff) | |
Include a pointer to the query's source text in QueryDesc structs. This is
practically free given prior 8.4 changes in plancache and portal management,
and it makes it a lot easier for ExecutorStart/Run/End hooks to get at the
query text. Extracted from Itagaki Takahiro's pg_stat_statements patch,
with minor editorialization.
Diffstat (limited to 'src/include')
| -rw-r--r-- | src/include/commands/explain.h | 8 | ||||
| -rw-r--r-- | src/include/executor/execdesc.h | 5 |
2 files changed, 9 insertions, 4 deletions
diff --git a/src/include/commands/explain.h b/src/include/commands/explain.h index e3a2a65004..2903d394ba 100644 --- a/src/include/commands/explain.h +++ b/src/include/commands/explain.h @@ -6,7 +6,7 @@ * Portions Copyright (c) 1996-2009, PostgreSQL Global Development Group * Portions Copyright (c) 1994-5, Regents of the University of California * - * $PostgreSQL: pgsql/src/include/commands/explain.h,v 1.37 2009/01/01 17:23:58 momjian Exp $ + * $PostgreSQL: pgsql/src/include/commands/explain.h,v 1.38 2009/01/02 20:42:00 tgl Exp $ * *------------------------------------------------------------------------- */ @@ -38,8 +38,10 @@ extern void ExplainOneUtility(Node *utilityStmt, ExplainStmt *stmt, ParamListInfo params, TupOutputState *tstate); -extern void ExplainOnePlan(PlannedStmt *plannedstmt, ParamListInfo params, - ExplainStmt *stmt, TupOutputState *tstate); +extern void ExplainOnePlan(PlannedStmt *plannedstmt, ExplainStmt *stmt, + const char *queryString, + ParamListInfo params, + TupOutputState *tstate); extern void ExplainPrintPlan(StringInfo str, QueryDesc *queryDesc, bool analyze, bool verbose); diff --git a/src/include/executor/execdesc.h b/src/include/executor/execdesc.h index fb3f56b786..9682c4b73a 100644 --- a/src/include/executor/execdesc.h +++ b/src/include/executor/execdesc.h @@ -8,7 +8,7 @@ * Portions Copyright (c) 1996-2009, PostgreSQL Global Development Group * Portions Copyright (c) 1994, Regents of the University of California * - * $PostgreSQL: pgsql/src/include/executor/execdesc.h,v 1.39 2009/01/01 17:23:59 momjian Exp $ + * $PostgreSQL: pgsql/src/include/executor/execdesc.h,v 1.40 2009/01/02 20:42:00 tgl Exp $ * *------------------------------------------------------------------------- */ @@ -37,6 +37,7 @@ typedef struct QueryDesc CmdType operation; /* CMD_SELECT, CMD_UPDATE, etc. */ PlannedStmt *plannedstmt; /* planner's output, or null if utility */ Node *utilitystmt; /* utility statement, or null */ + const char *sourceText; /* source text of the query */ Snapshot snapshot; /* snapshot to use for query */ Snapshot crosscheck_snapshot; /* crosscheck for RI update/delete */ DestReceiver *dest; /* the destination for tuple output */ @@ -54,6 +55,7 @@ typedef struct QueryDesc /* in pquery.c */ extern QueryDesc *CreateQueryDesc(PlannedStmt *plannedstmt, + const char *sourceText, Snapshot snapshot, Snapshot crosscheck_snapshot, DestReceiver *dest, @@ -61,6 +63,7 @@ extern QueryDesc *CreateQueryDesc(PlannedStmt *plannedstmt, bool doInstrument); extern QueryDesc *CreateUtilityQueryDesc(Node *utilitystmt, + const char *sourceText, Snapshot snapshot, DestReceiver *dest, ParamListInfo params); |
