| From 280db3fdb6c365dd37d82afaeeebd16efa70e965 Mon Sep 17 00:00:00 2001 |
| From: Sven Klemm <sven@timescale.com> |
| Date: Wed, 30 Sep 2020 01:45:29 +0200 |
| Subject: [PATCH] Adjust planner code to PG13 planner_hook signature |
| change |
| |
| PG13 adds the query string as argument to the planner_hook. |
| |
| https://github.com/postgres/postgres/commit/6aba63ef3e |
| |
| Signed-off-by: Maxim Kochetkov <fido_max@inbox.ru> |
| Fetch from: https://github.com/timescale/timescaledb/pull/2498/commits/90e3eb3df98f3165f08a17bf5548e3a30713de26.patch |
| --- |
| src/planner.c | 17 +++++++++++++++-- |
| 1 file changed, 15 insertions(+), 2 deletions(-) |
| |
| diff --git a/src/planner.c b/src/planner.c |
| index b4d4907a..cd40fa84 100644 |
| --- a/src/planner.c |
| +++ b/src/planner.c |
| @@ -278,7 +278,12 @@ preprocess_query(Node *node, Query *rootquery) |
| } |
| |
| static PlannedStmt * |
| +#if PG13_GE |
| +timescaledb_planner(Query *parse, const char *query_string, int cursor_opts, |
| + ParamListInfo bound_params) |
| +#else |
| timescaledb_planner(Query *parse, int cursor_opts, ParamListInfo bound_params) |
| +#endif |
| { |
| PlannedStmt *stmt; |
| ListCell *lc; |
| @@ -302,11 +307,19 @@ timescaledb_planner(Query *parse, int cursor_opts, ParamListInfo bound_params) |
| preprocess_query((Node *) parse, parse); |
| |
| if (prev_planner_hook != NULL) |
| - /* Call any earlier hooks */ |
| + /* Call any earlier hooks */ |
| +#if PG13_GE |
| + stmt = (prev_planner_hook)(parse, query_string, cursor_opts, bound_params); |
| +#else |
| stmt = (prev_planner_hook)(parse, cursor_opts, bound_params); |
| +#endif |
| else |
| - /* Call the standard planner */ |
| + /* Call the standard planner */ |
| +#if PG13_GE |
| + stmt = standard_planner(parse, query_string, cursor_opts, bound_params); |
| +#else |
| stmt = standard_planner(parse, cursor_opts, bound_params); |
| +#endif |
| |
| if (ts_extension_is_loaded()) |
| { |
| -- |
| 2.29.2 |
| |