Index: pgsql83/doc/src/sgml/ref/discard.sgml
===================================================================
*** /dev/null 1970-01-01 00:00:00.000000000 +0000
--- pgsql83/doc/src/sgml/ref/discard.sgml 2007-04-24 17:00:12.000000000 +0300
***************
*** 0 ****
--- 1,101 ----
+
+
+
+
+ RESET
+ SQL - Language Statements
+
+
+
+ DISCARD
+ Discard internal server state
+
+
+
+ DISCARD
+
+
+
+
+ DISCARD { ALL | PLANS | TEMP | TEMPORARY }
+
+
+
+
+ Description
+
+
+ DISCARD> can be used to release internal resources
+ that are usually released at the end of session. DISCARD
+ TEMP> drops all temporary tables created in the current session.
+ DISCARD PLANS> releases all internally cached plans.
+ DISCARD ALL> releases all externally visible temporary
+ resources associated with the current session.
+
+
+
+
+ Parameters
+
+
+
+
+ TEMP, TEMPORARY
+
+
+ Drops all temporary tables created in the current session.
+
+
+
+
+
+ PLANS
+
+
+ Releases all cached query plans.
+
+
+
+
+
+ ALL
+
+
+ Releases all temporary resources associated with the current
+ session. This has the same effect as executing the following
+ command sequence:
+
+ SET SESSION AUTHORIZATION DEFAULT;
+ RESET ALL;
+ DEALLOCATE ALL;
+ CLOSE ALL;
+ UNLISTEN *;
+ DISCARD PLANS;
+ DISCARD TEMP;
+
+
+
+
+
+
+
+
+
+ Notes
+
+
+ DISCARD ALL> cannot be executed inside a transaction block.
+
+
+
+
+ Compatibility
+
+
+ DISCARD is a PostgreSQL extension.
+
+
+
Index: pgsql83/doc/src/sgml/ref/allfiles.sgml
===================================================================
*** pgsql83.orig/doc/src/sgml/ref/allfiles.sgml 2007-04-17 16:45:20.000000000 +0300
--- pgsql83/doc/src/sgml/ref/allfiles.sgml 2007-04-24 17:00:12.000000000 +0300
***************
*** 61,66 ****
--- 61,67 ----
+
Index: pgsql83/doc/src/sgml/ref/reset.sgml
===================================================================
*** pgsql83.orig/doc/src/sgml/ref/reset.sgml 2007-04-17 16:45:20.000000000 +0300
--- pgsql83/doc/src/sgml/ref/reset.sgml 2007-04-24 17:00:12.000000000 +0300
***************
*** 22,31 ****
RESET configuration_parameter
RESET ALL
- RESET { PLANS | SESSION | TEMP | TEMPORARY }
!
Description
--- 22,30 ----
RESET configuration_parameter
RESET ALL
!
Description
***************
*** 42,48 ****
The default value is defined as the value that the parameter would
! have had, if no SET> had ever been issued for it in the
current session. The actual source of this value might be a
compiled-in default, the configuration file, command-line options,
or per-database or per-user default settings. See
The default value is defined as the value that the parameter would
! have had, had no SET> ever been issued for it in the
current session. The actual source of this value might be a
compiled-in default, the configuration file, command-line options,
or per-database or per-user default settings. See SET> reference page for details on the
transaction behavior of RESET>.
-
-
- RESET> can also be used to release internal resources
- that are usually released at the end of session. RESET
- TEMP> drops all temporary tables created in the current session.
- RESET PLANS> releases all internally cached plans.
- RESET SESSION> releases all externally visible temporary
- resources associated with the current session.
-
--- 52,57 ----
***************
*** 86,142 ****
-
-
- TEMP, TEMPORARY
-
-
- Drops all temporary tables created in the current session.
-
-
-
-
-
- PLANS
-
-
- Releases all cached query plans.
-
-
-
-
-
- SESSION
-
-
- Releases all temporary resources associated with the current
- session. This has the same effect as executing the following
- command sequence:
-
- SET SESSION AUTHORIZATION DEFAULT;
- RESET ALL;
- DEALLOCATE ALL;
- CLOSE ALL;
- UNLISTEN *;
- RESET PLANS;
- RESET TEMP;
-
-
-
-
-
- Notes
-
-
- RESET SESSION> cannot be executed inside a transaction block.
-
-
-
-
Examples
--- 76,85 ----
Index: pgsql83/doc/src/sgml/reference.sgml
===================================================================
*** pgsql83.orig/doc/src/sgml/reference.sgml 2007-04-17 16:45:20.000000000 +0300
--- pgsql83/doc/src/sgml/reference.sgml 2007-04-24 17:00:12.000000000 +0300
***************
*** 89,94 ****
--- 89,95 ----
&deallocate;
&declare;
&delete;
+ &discard;
&dropAggregate;
&dropCast;
&dropConversion;
Index: pgsql83/src/backend/nodes/copyfuncs.c
===================================================================
*** pgsql83.orig/src/backend/nodes/copyfuncs.c 2007-04-17 16:45:20.000000000 +0300
--- pgsql83/src/backend/nodes/copyfuncs.c 2007-04-24 17:21:00.000000000 +0300
***************
*** 2589,2594 ****
--- 2589,2604 ----
return newnode;
}
+ static DiscardStmt *
+ _copyDiscardStmt(DiscardStmt *from)
+ {
+ DiscardStmt *newnode = makeNode(DiscardStmt);
+
+ COPY_SCALAR_FIELD(target);
+
+ return newnode;
+ }
+
static CreateTableSpaceStmt *
_copyCreateTableSpaceStmt(CreateTableSpaceStmt *from)
{
***************
*** 3380,3385 ****
--- 3390,3398 ----
case T_VariableResetStmt:
retval = _copyVariableResetStmt(from);
break;
+ case T_DiscardStmt:
+ retval = _copyDiscardStmt(from);
+ break;
case T_CreateTableSpaceStmt:
retval = _copyCreateTableSpaceStmt(from);
break;
Index: pgsql83/src/backend/nodes/equalfuncs.c
===================================================================
*** pgsql83.orig/src/backend/nodes/equalfuncs.c 2007-04-17 16:45:20.000000000 +0300
--- pgsql83/src/backend/nodes/equalfuncs.c 2007-04-24 17:21:29.000000000 +0300
***************
*** 1377,1382 ****
--- 1377,1390 ----
}
static bool
+ _equalDiscardStmt(DiscardStmt *a, DiscardStmt *b)
+ {
+ COMPARE_SCALAR_FIELD(target);
+
+ return true;
+ }
+
+ static bool
_equalCreateTableSpaceStmt(CreateTableSpaceStmt *a, CreateTableSpaceStmt *b)
{
COMPARE_STRING_FIELD(tablespacename);
***************
*** 2313,2318 ****
--- 2321,2329 ----
case T_VariableResetStmt:
retval = _equalVariableResetStmt(a, b);
break;
+ case T_DiscardStmt:
+ retval = _equalDiscardStmt(a, b);
+ break;
case T_CreateTableSpaceStmt:
retval = _equalCreateTableSpaceStmt(a, b);
break;
Index: pgsql83/src/backend/parser/gram.y
===================================================================
*** pgsql83.orig/src/backend/parser/gram.y 2007-04-17 16:45:20.000000000 +0300
--- pgsql83/src/backend/parser/gram.y 2007-04-24 17:22:31.000000000 +0300
***************
*** 158,164 ****
CreateOpFamilyStmt AlterOpFamilyStmt CreatePLangStmt
CreateSchemaStmt CreateSeqStmt CreateStmt CreateTableSpaceStmt
CreateAssertStmt CreateTrigStmt CreateUserStmt CreateRoleStmt
! CreatedbStmt DeclareCursorStmt DefineStmt DeleteStmt
DropGroupStmt DropOpClassStmt DropOpFamilyStmt DropPLangStmt DropStmt
DropAssertStmt DropTrigStmt DropRuleStmt DropCastStmt DropRoleStmt
DropUserStmt DropdbStmt DropTableSpaceStmt ExplainStmt FetchStmt
--- 158,164 ----
CreateOpFamilyStmt AlterOpFamilyStmt CreatePLangStmt
CreateSchemaStmt CreateSeqStmt CreateStmt CreateTableSpaceStmt
CreateAssertStmt CreateTrigStmt CreateUserStmt CreateRoleStmt
! CreatedbStmt DeclareCursorStmt DefineStmt DeleteStmt DiscardStmt
DropGroupStmt DropOpClassStmt DropOpFamilyStmt DropPLangStmt DropStmt
DropAssertStmt DropTrigStmt DropRuleStmt DropCastStmt DropRoleStmt
DropUserStmt DropdbStmt DropTableSpaceStmt ExplainStmt FetchStmt
***************
*** 382,388 ****
DATABASE DAY_P DEALLOCATE DEC DECIMAL_P DECLARE DEFAULT DEFAULTS
DEFERRABLE DEFERRED DEFINER DELETE_P DELIMITER DELIMITERS
! DESC DISABLE_P DISTINCT DO DOCUMENT_P DOMAIN_P DOUBLE_P DROP
EACH ELSE ENABLE_P ENCODING ENCRYPTED END_P ENUM_P ESCAPE EXCEPT EXCLUDING
EXCLUSIVE EXECUTE EXISTS EXPLAIN EXTERNAL EXTRACT
--- 382,388 ----
DATABASE DAY_P DEALLOCATE DEC DECIMAL_P DECLARE DEFAULT DEFAULTS
DEFERRABLE DEFERRED DEFINER DELETE_P DELIMITER DELIMITERS
! DESC DISABLE_P DISCARD DISTINCT DO DOCUMENT_P DOMAIN_P DOUBLE_P DROP
EACH ELSE ENABLE_P ENCODING ENCRYPTED END_P ENUM_P ESCAPE EXCEPT EXCLUDING
EXCLUSIVE EXECUTE EXISTS EXPLAIN EXTERNAL EXTRACT
***************
*** 416,422 ****
OBJECT_P OF OFF OFFSET OIDS OLD ON ONLY OPERATOR OPTION OR
ORDER OUT_P OUTER_P OVERLAPS OVERLAY OWNED OWNER
! PARTIAL PASSWORD PLACING POSITION
PRECISION PRESERVE PREPARE PREPARED PRIMARY
PRIOR PRIVILEGES PROCEDURAL PROCEDURE
--- 416,422 ----
OBJECT_P OF OFF OFFSET OIDS OLD ON ONLY OPERATOR OPTION OR
ORDER OUT_P OUTER_P OVERLAPS OVERLAY OWNED OWNER
! PARTIAL PASSWORD PLACING PLANS POSITION
PRECISION PRESERVE PREPARE PREPARED PRIMARY
PRIOR PRIVILEGES PROCEDURAL PROCEDURE
***************
*** 569,574 ****
--- 569,575 ----
| DeclareCursorStmt
| DefineStmt
| DeleteStmt
+ | DiscardStmt
| DropAssertStmt
| DropCastStmt
| DropGroupStmt
***************
*** 1330,1335 ****
--- 1331,1370 ----
/*****************************************************************************
*
+ * DISCARD { ALL | TEMP | PLANS }
+ *
+ *****************************************************************************/
+
+ DiscardStmt:
+ DISCARD ALL
+ {
+ DiscardStmt *n = makeNode(DiscardStmt);
+ n->target = DISCARD_ALL;
+ $$ = (Node *) n;
+ }
+ | DISCARD TEMP
+ {
+ DiscardStmt *n = makeNode(DiscardStmt);
+ n->target = DISCARD_TEMP;
+ $$ = (Node *) n;
+ }
+ | DISCARD TEMPORARY
+ {
+ DiscardStmt *n = makeNode(DiscardStmt);
+ n->target = DISCARD_TEMP;
+ $$ = (Node *) n;
+ }
+ | DISCARD PLANS
+ {
+ DiscardStmt *n = makeNode(DiscardStmt);
+ n->target = DISCARD_PLANS;
+ $$ = (Node *) n;
+ }
+ ;
+
+
+ /*****************************************************************************
+ *
* ALTER [ TABLE | INDEX ] variations
*
*****************************************************************************/
***************
*** 8796,8801 ****
--- 8831,8837 ----
| DELIMITER
| DELIMITERS
| DISABLE_P
+ | DISCARD
| DOCUMENT_P
| DOMAIN_P
| DOUBLE_P
***************
*** 8881,8886 ****
--- 8917,8923 ----
| OWNER
| PARTIAL
| PASSWORD
+ | PLANS
| PREPARE
| PREPARED
| PRESERVE
Index: pgsql83/src/backend/parser/keywords.c
===================================================================
*** pgsql83.orig/src/backend/parser/keywords.c 2007-04-17 16:45:20.000000000 +0300
--- pgsql83/src/backend/parser/keywords.c 2007-04-24 17:00:12.000000000 +0300
***************
*** 124,129 ****
--- 124,130 ----
{"delimiters", DELIMITERS},
{"desc", DESC},
{"disable", DISABLE_P},
+ {"discard", DISCARD},
{"distinct", DISTINCT},
{"do", DO},
{"document", DOCUMENT_P},
***************
*** 269,274 ****
--- 270,276 ----
{"partial", PARTIAL},
{"password", PASSWORD},
{"placing", PLACING},
+ {"plans", PLANS},
{"position", POSITION},
{"precision", PRECISION},
{"prepare", PREPARE},
Index: pgsql83/src/backend/tcop/utility.c
===================================================================
*** pgsql83.orig/src/backend/tcop/utility.c 2007-04-17 16:45:20.000000000 +0300
--- pgsql83/src/backend/tcop/utility.c 2007-04-24 17:46:22.000000000 +0300
***************
*** 29,34 ****
--- 29,35 ----
#include "commands/copy.h"
#include "commands/dbcommands.h"
#include "commands/defrem.h"
+ #include "commands/discard.h"
#include "commands/explain.h"
#include "commands/lockcmds.h"
#include "commands/portalcmds.h"
***************
*** 994,999 ****
--- 995,1004 ----
}
break;
+ case T_DiscardStmt:
+ DiscardCommand((DiscardStmt *) parsetree, isTopLevel);
+ break;
+
case T_CreateTrigStmt:
CreateTrigger((CreateTrigStmt *) parsetree, InvalidOid);
break;
***************
*** 1752,1763 ****
break;
case T_VariableResetStmt:
! {
! VariableResetStmt *stmt = (VariableResetStmt *) parsetree;
! if (pg_strcasecmp(stmt->name, "session") == 0)
! tag = "RESET SESSION";
! else
! tag = "RESET";
}
break;
--- 1757,1779 ----
break;
case T_VariableResetStmt:
! tag = "RESET";
! break;
!
! case T_DiscardStmt:
! switch (((DiscardStmt *) parsetree)->target) {
! case DISCARD_ALL:
! tag = "DISCARD ALL";
! break;
! case DISCARD_PLANS:
! tag = "DISCARD PLANS";
! break;
! case DISCARD_TEMP:
! tag = "DISCARD TEMP";
! break;
! default:
! tag = "DISCARD ???";
! break;
}
break;
Index: pgsql83/src/backend/utils/misc/guc.c
===================================================================
*** pgsql83.orig/src/backend/utils/misc/guc.c 2007-04-22 18:22:18.000000000 +0300
--- pgsql83/src/backend/utils/misc/guc.c 2007-04-24 17:03:17.000000000 +0300
***************
*** 5048,5077 ****
}
/*
- * RESET SESSION command.
- */
- static void
- ResetSession(bool isTopLevel)
- {
- /*
- * Disallow RESET SESSION in a transaction block. This is arguably
- * inconsistent (we don't make a similar check in the command
- * sequence that RESET SESSION is equivalent to), but the idea is
- * to catch mistakes: RESET SESSION inside a transaction block
- * would leave the transaction still uncommitted.
- */
- PreventTransactionChain(isTopLevel, "RESET SESSION");
-
- SetPGVariable("session_authorization", NIL, false);
- ResetAllOptions();
- DropAllPreparedStatements();
- PortalHashTableDeleteAll();
- Async_UnlistenAll();
- ResetPlanCache();
- ResetTempTableNamespace();
- }
-
- /*
* RESET command
*/
void
--- 5048,5053 ----
***************
*** 5079,5091 ****
{
if (pg_strcasecmp(name, "all") == 0)
ResetAllOptions();
- else if (pg_strcasecmp(name, "session") == 0)
- ResetSession(isTopLevel);
- else if (pg_strcasecmp(name, "temp") == 0 ||
- pg_strcasecmp(name, "temporary") == 0)
- ResetTempTableNamespace();
- else if (pg_strcasecmp(name, "plans") == 0)
- ResetPlanCache();
else
set_config_option(name,
NULL,
--- 5055,5060 ----
Index: pgsql83/src/backend/utils/mmgr/portalmem.c
===================================================================
*** pgsql83.orig/src/backend/utils/mmgr/portalmem.c 2007-04-17 16:45:20.000000000 +0300
--- pgsql83/src/backend/utils/mmgr/portalmem.c 2007-04-24 17:00:12.000000000 +0300
***************
*** 455,461 ****
/*
* Delete all declared cursors.
*
! * Used by commands: CLOSE ALL, RESET SESSION
*/
void
PortalHashTableDeleteAll(void)
--- 455,461 ----
/*
* Delete all declared cursors.
*
! * Used by commands: CLOSE ALL, DISCARD ALL
*/
void
PortalHashTableDeleteAll(void)
Index: pgsql83/src/include/nodes/nodes.h
===================================================================
*** pgsql83.orig/src/include/nodes/nodes.h 2007-04-17 16:45:20.000000000 +0300
--- pgsql83/src/include/nodes/nodes.h 2007-04-24 17:00:12.000000000 +0300
***************
*** 273,278 ****
--- 273,279 ----
T_VariableSetStmt,
T_VariableShowStmt,
T_VariableResetStmt,
+ T_DiscardStmt,
T_CreateTrigStmt,
T_DropPropertyStmt,
T_CreatePLangStmt,
Index: pgsql83/src/include/nodes/parsenodes.h
===================================================================
*** pgsql83.orig/src/include/nodes/parsenodes.h 2007-04-17 16:45:20.000000000 +0300
--- pgsql83/src/include/nodes/parsenodes.h 2007-04-24 17:19:02.000000000 +0300
***************
*** 1871,1876 ****
--- 1871,1894 ----
} VariableResetStmt;
/* ----------------------
+ * Discard Statement
+ * ----------------------
+ */
+
+ typedef enum DiscardMode
+ {
+ DISCARD_ALL,
+ DISCARD_PLANS,
+ DISCARD_TEMP
+ } DiscardMode;
+
+ typedef struct DiscardStmt
+ {
+ NodeTag type;
+ DiscardMode target;
+ } DiscardStmt;
+
+ /* ----------------------
* LOCK Statement
* ----------------------
*/
Index: pgsql83/src/test/regress/expected/guc.out
===================================================================
*** pgsql83.orig/src/test/regress/expected/guc.out 2007-04-17 16:45:20.000000000 +0300
--- pgsql83/src/test/regress/expected/guc.out 2007-04-24 17:00:12.000000000 +0300
***************
*** 426,432 ****
(1 row)
--
! -- Test RESET TEMP
--
CREATE TEMP TABLE reset_test ( data text ) ON COMMIT DELETE ROWS;
SELECT relname FROM pg_class WHERE relname = 'reset_test';
--- 426,432 ----
(1 row)
--
! -- Test DISCARD TEMP
--
CREATE TEMP TABLE reset_test ( data text ) ON COMMIT DELETE ROWS;
SELECT relname FROM pg_class WHERE relname = 'reset_test';
***************
*** 435,448 ****
reset_test
(1 row)
! RESET TEMP;
SELECT relname FROM pg_class WHERE relname = 'reset_test';
relname
---------
(0 rows)
--
! -- Test RESET SESSION
--
-- do changes
DECLARE foo CURSOR WITH HOLD FOR SELECT 1;
--- 435,448 ----
reset_test
(1 row)
! DISCARD TEMP;
SELECT relname FROM pg_class WHERE relname = 'reset_test';
relname
---------
(0 rows)
--
! -- Test DISCARD ALL
--
-- do changes
DECLARE foo CURSOR WITH HOLD FOR SELECT 1;
***************
*** 489,496 ****
t
(1 row)
! -- big RESET
! RESET SESSION;
-- look again
SELECT relname FROM pg_listener;
relname
--- 489,496 ----
t
(1 row)
! -- discard everything
! DISCARD ALL;
-- look again
SELECT relname FROM pg_listener;
relname
Index: pgsql83/src/test/regress/sql/guc.sql
===================================================================
*** pgsql83.orig/src/test/regress/sql/guc.sql 2007-04-17 16:45:20.000000000 +0300
--- pgsql83/src/test/regress/sql/guc.sql 2007-04-24 17:00:12.000000000 +0300
***************
*** 125,139 ****
SELECT '2006-08-13 12:34:56'::timestamptz;
--
! -- Test RESET TEMP
--
CREATE TEMP TABLE reset_test ( data text ) ON COMMIT DELETE ROWS;
SELECT relname FROM pg_class WHERE relname = 'reset_test';
! RESET TEMP;
SELECT relname FROM pg_class WHERE relname = 'reset_test';
--
! -- Test RESET SESSION
--
-- do changes
--- 125,139 ----
SELECT '2006-08-13 12:34:56'::timestamptz;
--
! -- Test DISCARD TEMP
--
CREATE TEMP TABLE reset_test ( data text ) ON COMMIT DELETE ROWS;
SELECT relname FROM pg_class WHERE relname = 'reset_test';
! DISCARD TEMP;
SELECT relname FROM pg_class WHERE relname = 'reset_test';
--
! -- Test DISCARD ALL
--
-- do changes
***************
*** 151,158 ****
SHOW vacuum_cost_delay;
SELECT relname from pg_class where relname = 'tmp_foo';
SELECT current_user = 'temp_reset_user';
! -- big RESET
! RESET SESSION;
-- look again
SELECT relname FROM pg_listener;
SELECT name FROM pg_prepared_statements;
--- 151,158 ----
SHOW vacuum_cost_delay;
SELECT relname from pg_class where relname = 'tmp_foo';
SELECT current_user = 'temp_reset_user';
! -- discard everything
! DISCARD ALL;
-- look again
SELECT relname FROM pg_listener;
SELECT name FROM pg_prepared_statements;
Index: pgsql83/src/backend/commands/Makefile
===================================================================
*** pgsql83.orig/src/backend/commands/Makefile 2007-02-28 15:29:25.000000000 +0200
--- pgsql83/src/backend/commands/Makefile 2007-04-24 17:01:12.000000000 +0300
***************
*** 14,20 ****
OBJS = aggregatecmds.o alter.o analyze.o async.o cluster.o comment.o \
conversioncmds.o copy.o \
! dbcommands.o define.o explain.o functioncmds.o \
indexcmds.o lockcmds.o operatorcmds.o opclasscmds.o \
portalcmds.o prepare.o proclang.o \
schemacmds.o sequence.o tablecmds.o tablespace.o trigger.o \
--- 14,20 ----
OBJS = aggregatecmds.o alter.o analyze.o async.o cluster.o comment.o \
conversioncmds.o copy.o \
! dbcommands.o define.o discard.o explain.o functioncmds.o \
indexcmds.o lockcmds.o operatorcmds.o opclasscmds.o \
portalcmds.o prepare.o proclang.o \
schemacmds.o sequence.o tablecmds.o tablespace.o trigger.o \
Index: pgsql83/src/backend/commands/discard.c
===================================================================
*** /dev/null 1970-01-01 00:00:00.000000000 +0000
--- pgsql83/src/backend/commands/discard.c 2007-04-24 17:34:00.000000000 +0300
***************
*** 0 ****
--- 1,69 ----
+ /*-------------------------------------------------------------------------
+ *
+ * discard.c
+ * DISCARD command support code
+ *
+ * Portions Copyright (c) 1996-2007, PostgreSQL Global Development Group
+ *
+ *
+ * IDENTIFICATION
+ * $PostgreSQL$
+ *
+ *-------------------------------------------------------------------------
+ */
+ #include "postgres.h"
+
+ #include "access/xact.h"
+ #include "catalog/namespace.h"
+ #include "commands/async.h"
+ #include "commands/discard.h"
+ #include "commands/prepare.h"
+ #include "commands/variable.h"
+ #include "utils/portal.h"
+ #include "utils/plancache.h"
+
+
+ /*
+ * DISCARD ALL command.
+ */
+ static void
+ DiscardAll(bool isTopLevel)
+ {
+ /*
+ * Disallow DISCARD ALL in a transaction block. This is arguably
+ * inconsistent (we don't make a similar check in the command
+ * sequence that DISCARD ALL is equivalent to), but the idea is
+ * to catch mistakes: DISCARD ALL inside a transaction block
+ * would leave the transaction still uncommitted.
+ */
+ PreventTransactionChain(isTopLevel, "DISCARD ALL");
+
+ SetPGVariable("session_authorization", NIL, false);
+ ResetAllOptions();
+ DropAllPreparedStatements();
+ PortalHashTableDeleteAll();
+ Async_UnlistenAll();
+ ResetPlanCache();
+ ResetTempTableNamespace();
+ }
+
+ /*
+ * DISCARD { ALL | TEMP | PLANS }
+ */
+ void
+ DiscardCommand(DiscardStmt *stmt, bool isTopLevel)
+ {
+ switch (stmt->target) {
+ case DISCARD_ALL:
+ DiscardAll(isTopLevel);
+ break;
+ case DISCARD_PLANS:
+ ResetPlanCache();
+ break;
+ case DISCARD_TEMP:
+ ResetTempTableNamespace();
+ break;
+ }
+ }
+
+
Index: pgsql83/src/include/commands/discard.h
===================================================================
*** /dev/null 1970-01-01 00:00:00.000000000 +0000
--- pgsql83/src/include/commands/discard.h 2007-04-24 17:17:17.000000000 +0300
***************
*** 0 ****
--- 1,24 ----
+ /*-------------------------------------------------------------------------
+ *
+ * discard.h
+ * prototypes for discard.c.
+ *
+ *
+ * Portions Copyright (c) 1996-2007, PostgreSQL Global Development Group
+ * Portions Copyright (c) 1994, Regents of the University of California
+ *
+ * $PostgreSQL$
+ *
+ *-------------------------------------------------------------------------
+ */
+ #ifndef DISCARD_H
+ #define DISCARD_H
+
+ #include "nodes/parsenodes.h"
+
+ /*
+ * DISCARD
+ */
+ extern void DiscardCommand(DiscardStmt *stmt, bool isTopLevel);
+
+ #endif /* LOCKCMDS_H */
Index: pgsql83/src/bin/psql/tab-complete.c
===================================================================
*** pgsql83.orig/src/bin/psql/tab-complete.c 2007-04-08 10:09:58.000000000 +0300
--- pgsql83/src/bin/psql/tab-complete.c 2007-04-24 17:55:41.000000000 +0300
***************
*** 527,534 ****
static const char *const sql_commands[] = {
"ABORT", "ALTER", "ANALYZE", "BEGIN", "CHECKPOINT", "CLOSE", "CLUSTER",
"COMMENT", "COMMIT", "COPY", "CREATE", "DEALLOCATE", "DECLARE",
! "DELETE FROM", "DROP", "END", "EXECUTE", "EXPLAIN", "FETCH", "GRANT",
! "INSERT", "LISTEN", "LOAD", "LOCK", "MOVE", "NOTIFY", "PREPARE",
"REASSIGN", "REINDEX", "RELEASE", "RESET", "REVOKE", "ROLLBACK",
"SAVEPOINT", "SELECT", "SET", "SHOW", "START", "TRUNCATE", "UNLISTEN",
"UPDATE", "VACUUM", NULL
--- 527,534 ----
static const char *const sql_commands[] = {
"ABORT", "ALTER", "ANALYZE", "BEGIN", "CHECKPOINT", "CLOSE", "CLUSTER",
"COMMENT", "COMMIT", "COPY", "CREATE", "DEALLOCATE", "DECLARE",
! "DELETE FROM", "DISCARD", "DROP", "END", "EXECUTE", "EXPLAIN", "FETCH",
! "GRANT", "INSERT", "LISTEN", "LOAD", "LOCK", "MOVE", "NOTIFY", "PREPARE",
"REASSIGN", "REINDEX", "RELEASE", "RESET", "REVOKE", "ROLLBACK",
"SAVEPOINT", "SELECT", "SET", "SHOW", "START", "TRUNCATE", "UNLISTEN",
"UPDATE", "VACUUM", NULL
***************
*** 1244,1249 ****
--- 1244,1258 ----
}
/* XXX: implement tab completion for DELETE ... USING */
+ /* DISCARD */
+ else if (pg_strcasecmp(prev_wd, "DISCARD") == 0)
+ {
+ static const char *const list_DISCARD[] =
+ {"ALL", "PLANS", "TEMP", NULL};
+
+ COMPLETE_WITH_LIST(list_DISCARD);
+ }
+
/* DROP (when not the previous word) */
/* DROP AGGREGATE */
else if (pg_strcasecmp(prev3_wd, "DROP") == 0 &&