From 44b928e876b06ba6801ec2c60d2cd914a2185c5d Mon Sep 17 00:00:00 2001 From: Neil Conway Date: Sun, 8 Jan 2006 07:00:27 +0000 Subject: 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. --- src/backend/tcop/postgres.c | 7 +++++-- 1 file changed, 5 insertions(+), 2 deletions(-) (limited to 'src/backend/tcop/postgres.c') diff --git a/src/backend/tcop/postgres.c b/src/backend/tcop/postgres.c index e38e66a38cb..0fe8ee057d5 100644 --- a/src/backend/tcop/postgres.c +++ b/src/backend/tcop/postgres.c @@ -8,7 +8,7 @@ * * * IDENTIFICATION - * $PostgreSQL: pgsql/src/backend/tcop/postgres.c,v 1.477 2006/01/05 10:07:45 petere Exp $ + * $PostgreSQL: pgsql/src/backend/tcop/postgres.c,v 1.478 2006/01/08 07:00:25 neilc Exp $ * * NOTES * this is the "main" module of the postgres backend and @@ -55,6 +55,7 @@ #include "tcop/pquery.h" #include "tcop/tcopprot.h" #include "tcop/utility.h" +#include "utils/builtins.h" #include "utils/flatfiles.h" #include "utils/guc.h" #include "utils/lsyscache.h" @@ -1308,7 +1309,8 @@ exec_parse_message(const char *query_string, /* string to execute */ commandTag, querytree_list, plantree_list, - param_list); + param_list, + false); } else { @@ -1322,6 +1324,7 @@ exec_parse_message(const char *query_string, /* string to execute */ pstmt->query_list = querytree_list; pstmt->plan_list = plantree_list; pstmt->argtype_list = param_list; + pstmt->from_sql = false; pstmt->context = unnamed_stmt_context; /* Now the unnamed statement is complete and valid */ unnamed_stmt_pstmt = pstmt; -- cgit v1.2.3