diff options
author | Jan Wieck <JanWieck@Yahoo.com> | 2001-05-21 14:22:19 +0000 |
---|---|---|
committer | Jan Wieck <JanWieck@Yahoo.com> | 2001-05-21 14:22:19 +0000 |
commit | d27f363e3fceb7612997ae89a8fc84de6754a213 (patch) | |
tree | 844989e8d2c1b8f4ab444a5d439eab50142abbf3 /src/backend/commands/command.c | |
parent | be03eb25f34c9c95c400504ef76c8abe0081d09f (diff) | |
download | postgresql-d27f363e3fceb7612997ae89a8fc84de6754a213.tar.gz postgresql-d27f363e3fceb7612997ae89a8fc84de6754a213.zip |
Enhancement of SPI to get access to portals
- New functions to create a portal using a prepared/saved
SPI plan or lookup an existing portal by name.
- Functions to fetch/move from/in portals. Results are placed
in the usual SPI_processed and SPI_tuptable, so the entire
set of utility functions can be used to gain attribute access.
- Prepared/saved SPI plans now use their own memory context
and SPI_freeplan(plan) can remove them.
- Tuple result sets (SPI_tuptable) now uses it's own memory
context and can be free'd by SPI_freetuptable(tuptab).
Enhancement of PL/pgSQL
- Uses generic named portals internally in FOR ... SELECT
loops to avoid running out of memory on huge result sets.
- Support for CURSOR and REFCURSOR syntax using the new SPI
functionality. Cursors used internally only need no explicit
transaction block. Refcursor variables can be used inside
of explicit transaction block to pass cursors between main
application and functions.
Jan
Diffstat (limited to 'src/backend/commands/command.c')
-rw-r--r-- | src/backend/commands/command.c | 8 |
1 files changed, 5 insertions, 3 deletions
diff --git a/src/backend/commands/command.c b/src/backend/commands/command.c index cd7e1d29524..bc5153b8005 100644 --- a/src/backend/commands/command.c +++ b/src/backend/commands/command.c @@ -8,7 +8,7 @@ * * * IDENTIFICATION - * $Header: /cvsroot/pgsql/src/backend/commands/Attic/command.c,v 1.127 2001/05/09 21:10:38 momjian Exp $ + * $Header: /cvsroot/pgsql/src/backend/commands/Attic/command.c,v 1.128 2001/05/21 14:22:11 wieck Exp $ * * NOTES * The PerformAddAttribute() code, like most of the relation @@ -108,6 +108,7 @@ PerformPortalFetch(char *name, QueryDesc *queryDesc; EState *estate; MemoryContext oldcontext; + bool faked_desc = false; /* * sanity checks @@ -143,13 +144,14 @@ PerformPortalFetch(char *name, queryDesc = PortalGetQueryDesc(portal); estate = PortalGetState(portal); - if (dest == None) /* MOVE */ + if (dest != queryDesc->dest) /* MOVE */ { QueryDesc *qdesc = (QueryDesc *) palloc(sizeof(QueryDesc)); memcpy(qdesc, queryDesc, sizeof(QueryDesc)); qdesc->dest = dest; queryDesc = qdesc; + faked_desc = true; } BeginCommand(name, @@ -197,7 +199,7 @@ PerformPortalFetch(char *name, /* * Clean up and switch back to old context. */ - if (dest == None) /* MOVE */ + if (faked_desc) /* MOVE */ pfree(queryDesc); MemoryContextSwitchTo(oldcontext); |