Skip to content

Commit dc9142f

Browse files
committed
When planning a query at Bind time, be careful to pass the correct
query_list into the Portal, ie, the one seen and possibly modified by the planner. My fault :-( Per report from Sergey Koposov.
1 parent 71a6f8b commit dc9142f

File tree

1 file changed

+6
-5
lines changed

1 file changed

+6
-5
lines changed

src/backend/tcop/postgres.c

Lines changed: 6 additions & 5 deletions
Original file line numberDiff line numberDiff line change
@@ -8,7 +8,7 @@
88
*
99
*
1010
* IDENTIFICATION
11-
* $PostgreSQL: pgsql/src/backend/tcop/postgres.c,v 1.512 2006/10/07 19:25:28 tgl Exp $
11+
* $PostgreSQL: pgsql/src/backend/tcop/postgres.c,v 1.513 2006/10/07 20:16:57 tgl Exp $
1212
*
1313
* NOTES
1414
* this is the "main" module of the postgres backend and
@@ -1294,6 +1294,7 @@ exec_bind_message(StringInfo input_message)
12941294
PreparedStatement *pstmt;
12951295
Portal portal;
12961296
ParamListInfo params;
1297+
List *query_list;
12971298
List *plan_list;
12981299
MemoryContext qContext;
12991300
bool save_log_statement_stats = log_statement_stats;
@@ -1572,13 +1573,13 @@ exec_bind_message(StringInfo input_message)
15721573

15731574
qContext = PortalGetHeapMemory(portal);
15741575
oldContext = MemoryContextSwitchTo(qContext);
1575-
plan_list = pg_plan_queries(copyObject(pstmt->query_list),
1576-
params,
1577-
true);
1576+
query_list = copyObject(pstmt->query_list);
1577+
plan_list = pg_plan_queries(query_list, params, true);
15781578
MemoryContextSwitchTo(oldContext);
15791579
}
15801580
else
15811581
{
1582+
query_list = pstmt->query_list;
15821583
plan_list = pstmt->plan_list;
15831584
qContext = pstmt->context;
15841585
}
@@ -1590,7 +1591,7 @@ exec_bind_message(StringInfo input_message)
15901591
*pstmt->stmt_name ? pstmt->stmt_name : NULL,
15911592
pstmt->query_string,
15921593
pstmt->commandTag,
1593-
pstmt->query_list,
1594+
query_list,
15941595
plan_list,
15951596
qContext);
15961597

0 commit comments

Comments
 (0)
pFad - Phonifier reborn

Pfad - The Proxy pFad of © 2024 Garber Painting. All rights reserved.

Note: This service is not intended for secure transactions such as banking, social media, email, or purchasing. Use at your own risk. We assume no liability whatsoever for broken pages.


Alternative Proxies:

Alternative Proxy

pFad Proxy

pFad v3 Proxy

pFad v4 Proxy