diff options
author | Tom Lane <tgl@sss.pgh.pa.us> | 2007-03-29 19:10:10 +0000 |
---|---|---|
committer | Tom Lane <tgl@sss.pgh.pa.us> | 2007-03-29 19:10:10 +0000 |
commit | 972e20b429dd222745ac6ba3269a44b2a7a574ff (patch) | |
tree | 3a4c2e58b9faeaba75cbd2ab1de5695dcc7986ed /src/backend/tcop/postgres.c | |
parent | 96b171903d5d52ca46b46bc3f73f13978705eae5 (diff) | |
download | postgresql-972e20b429dd222745ac6ba3269a44b2a7a574ff.tar.gz postgresql-972e20b429dd222745ac6ba3269a44b2a7a574ff.zip |
exec_parse_message neglected to copy parameter type array into the
required memory context when handling client-specified parameter types
for an unnamed statement. Per report from Kris Jurka.
Diffstat (limited to 'src/backend/tcop/postgres.c')
-rw-r--r-- | src/backend/tcop/postgres.c | 20 |
1 files changed, 16 insertions, 4 deletions
diff --git a/src/backend/tcop/postgres.c b/src/backend/tcop/postgres.c index 9f55ba2e387..bfcc271996e 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.529 2007/03/22 19:55:04 tgl Exp $ + * $PostgreSQL: pgsql/src/backend/tcop/postgres.c,v 1.530 2007/03/29 19:10:10 tgl Exp $ * * NOTES * this is the "main" module of the postgres backend and @@ -1239,12 +1239,24 @@ exec_parse_message(const char *query_string, /* string to execute */ } else { - /* query_string needs to be copied into unnamed_stmt_context */ - /* the rest is there already */ + /* + * paramTypes and query_string need to be copied into + * unnamed_stmt_context. The rest is there already + */ + Oid *newParamTypes; + + if (numParams > 0) + { + newParamTypes = (Oid *) palloc(numParams * sizeof(Oid)); + memcpy(newParamTypes, paramTypes, numParams * sizeof(Oid)); + } + else + newParamTypes = NULL; + unnamed_stmt_psrc = FastCreateCachedPlan(raw_parse_tree, pstrdup(query_string), commandTag, - paramTypes, + newParamTypes, numParams, stmt_list, fully_planned, |