diff options
| author | Tom Lane <tgl@sss.pgh.pa.us> | 2008-10-31 19:37:56 +0000 |
|---|---|---|
| committer | Tom Lane <tgl@sss.pgh.pa.us> | 2008-10-31 19:37:56 +0000 |
| commit | 9b46abb7c47de8aa408a8c83666fd67c5447eb85 (patch) | |
| tree | 034991f27008de03ff71f505431b10a1b2ae5e5e /src/backend/tcop | |
| parent | cd97f98844b5640b1cdc701c691c962155dce3b4 (diff) | |
| download | postgresql-9b46abb7c47de8aa408a8c83666fd67c5447eb85.tar.gz | |
Allow SQL-language functions to return the output of an INSERT/UPDATE/DELETE
RETURNING clause, not just a SELECT as formerly.
A side effect of this patch is that when a set-returning SQL function is used
in a FROM clause, performance is improved because the output is collected into
a tuplestore within the function, rather than using the less efficient
value-per-call mechanism.
Diffstat (limited to 'src/backend/tcop')
| -rw-r--r-- | src/backend/tcop/dest.c | 9 |
1 files changed, 8 insertions, 1 deletions
diff --git a/src/backend/tcop/dest.c b/src/backend/tcop/dest.c index d5b420b1c8..e687c52f80 100644 --- a/src/backend/tcop/dest.c +++ b/src/backend/tcop/dest.c @@ -8,7 +8,7 @@ * Portions Copyright (c) 1994, Regents of the University of California * * IDENTIFICATION - * $PostgreSQL: pgsql/src/backend/tcop/dest.c,v 1.72 2008/01/01 19:45:52 momjian Exp $ + * $PostgreSQL: pgsql/src/backend/tcop/dest.c,v 1.73 2008/10/31 19:37:56 tgl Exp $ * *------------------------------------------------------------------------- */ @@ -32,6 +32,7 @@ #include "access/xact.h" #include "commands/copy.h" #include "executor/executor.h" +#include "executor/functions.h" #include "executor/tstoreReceiver.h" #include "libpq/libpq.h" #include "libpq/pqformat.h" @@ -132,6 +133,9 @@ CreateDestReceiver(CommandDest dest, Portal portal) case DestCopyOut: return CreateCopyDestReceiver(); + + case DestSQLFunction: + return CreateSQLFunctionDestReceiver(); } /* should never get here */ @@ -158,6 +162,7 @@ EndCommand(const char *commandTag, CommandDest dest) case DestTuplestore: case DestIntoRel: case DestCopyOut: + case DestSQLFunction: break; } } @@ -198,6 +203,7 @@ NullCommand(CommandDest dest) case DestTuplestore: case DestIntoRel: case DestCopyOut: + case DestSQLFunction: break; } } @@ -240,6 +246,7 @@ ReadyForQuery(CommandDest dest) case DestTuplestore: case DestIntoRel: case DestCopyOut: + case DestSQLFunction: break; } } |
