mirror of
https://github.com/postgres/postgres.git
synced 2025-06-13 07:41:39 +03:00
Restructure parsetree representation of DECLARE CURSOR: now it's a
utility statement (DeclareCursorStmt) with a SELECT query dangling from it, rather than a SELECT query with a few unusual fields in it. Add code to determine whether a planned query can safely be run backwards. If DECLARE CURSOR specifies SCROLL, ensure that the plan can be run backwards by adding a Materialize plan node if it can't. Without SCROLL, you get an error if you try to fetch backwards from a cursor that can't handle it. (There is still some discussion about what the exact behavior should be, but this is necessary infrastructure in any case.) Along the way, make EXPLAIN DECLARE CURSOR work.
This commit is contained in:
@ -8,7 +8,7 @@
|
||||
*
|
||||
*
|
||||
* IDENTIFICATION
|
||||
* $Header: /cvsroot/pgsql/src/backend/tcop/postgres.c,v 1.316 2003/03/06 00:04:27 tgl Exp $
|
||||
* $Header: /cvsroot/pgsql/src/backend/tcop/postgres.c,v 1.317 2003/03/10 03:53:51 tgl Exp $
|
||||
*
|
||||
* NOTES
|
||||
* this is the "main" module of the postgres backend and
|
||||
@ -483,7 +483,7 @@ pg_plan_query(Query *querytree)
|
||||
ResetUsage();
|
||||
|
||||
/* call the optimizer */
|
||||
plan = planner(querytree);
|
||||
plan = planner(querytree, false, 0);
|
||||
|
||||
if (log_planner_stats)
|
||||
ShowUsage("PLANNER STATISTICS");
|
||||
@ -1789,7 +1789,7 @@ PostgresMain(int argc, char *argv[], const char *username)
|
||||
if (!IsUnderPostmaster)
|
||||
{
|
||||
puts("\nPOSTGRES backend interactive interface ");
|
||||
puts("$Revision: 1.316 $ $Date: 2003/03/06 00:04:27 $\n");
|
||||
puts("$Revision: 1.317 $ $Date: 2003/03/10 03:53:51 $\n");
|
||||
}
|
||||
|
||||
/*
|
||||
@ -2245,6 +2245,10 @@ CreateCommandTag(Node *parsetree)
|
||||
}
|
||||
break;
|
||||
|
||||
case T_DeclareCursorStmt:
|
||||
tag = "DECLARE CURSOR";
|
||||
break;
|
||||
|
||||
case T_ClosePortalStmt:
|
||||
tag = "CLOSE CURSOR";
|
||||
break;
|
||||
|
Reference in New Issue
Block a user