mirror of
https://github.com/postgres/postgres.git
synced 2025-08-22 21:53:06 +03:00
Add a new system view, pg_prepared_statements, that can be used to
access information about the prepared statements that are available in the current session. Original patch from Joachim Wieland, various improvements by Neil Conway. The "statement" column of the view contains the literal query string sent by the client, without any rewriting or pretty printing. This means that prepared statements created via SQL will be prefixed with "PREPARE ... AS ", whereas those prepared via the FE/BE protocol will not. That is unfortunate, but discussion on -patches did not yield an efficient way to improve this, and there is some merit in returning exactly what the client sent to the backend. Catalog version bumped, regression tests updated.
This commit is contained in:
@@ -6,7 +6,7 @@
|
||||
*
|
||||
* Copyright (c) 2002-2005, PostgreSQL Global Development Group
|
||||
*
|
||||
* $PostgreSQL: pgsql/src/include/commands/prepare.h,v 1.16 2005/12/14 17:06:28 tgl Exp $
|
||||
* $PostgreSQL: pgsql/src/include/commands/prepare.h,v 1.17 2006/01/08 07:00:26 neilc Exp $
|
||||
*
|
||||
*-------------------------------------------------------------------------
|
||||
*/
|
||||
@@ -30,13 +30,16 @@
|
||||
typedef struct
|
||||
{
|
||||
/* dynahash.c requires key to be first field */
|
||||
char stmt_name[NAMEDATALEN];
|
||||
char *query_string; /* text of query, or NULL */
|
||||
const char *commandTag; /* command tag (a constant!), or NULL */
|
||||
List *query_list; /* list of queries */
|
||||
List *plan_list; /* list of plans */
|
||||
List *argtype_list; /* list of parameter type OIDs */
|
||||
MemoryContext context; /* context containing this query */
|
||||
char stmt_name[NAMEDATALEN];
|
||||
char *query_string; /* text of query, or NULL */
|
||||
const char *commandTag; /* command tag (a constant!), or NULL */
|
||||
List *query_list; /* list of queries, rewritten */
|
||||
List *plan_list; /* list of plans */
|
||||
List *argtype_list; /* list of parameter type OIDs */
|
||||
TimestampTz prepare_time; /* the time when the stmt was prepared */
|
||||
bool from_sql; /* stmt prepared via SQL, not
|
||||
* FE/BE protocol? */
|
||||
MemoryContext context; /* context containing this query */
|
||||
} PreparedStatement;
|
||||
|
||||
|
||||
@@ -54,7 +57,8 @@ extern void StorePreparedStatement(const char *stmt_name,
|
||||
const char *commandTag,
|
||||
List *query_list,
|
||||
List *plan_list,
|
||||
List *argtype_list);
|
||||
List *argtype_list,
|
||||
bool from_sql);
|
||||
extern PreparedStatement *FetchPreparedStatement(const char *stmt_name,
|
||||
bool throwError);
|
||||
extern void DropPreparedStatement(const char *stmt_name, bool showError);
|
||||
|
Reference in New Issue
Block a user