You can subscribe to this list here.
2010 |
Jan
|
Feb
|
Mar
|
Apr
(4) |
May
(28) |
Jun
(12) |
Jul
(11) |
Aug
(12) |
Sep
(5) |
Oct
(19) |
Nov
(14) |
Dec
(12) |
---|---|---|---|---|---|---|---|---|---|---|---|---|
2011 |
Jan
(18) |
Feb
(30) |
Mar
(115) |
Apr
(89) |
May
(50) |
Jun
(44) |
Jul
(22) |
Aug
(13) |
Sep
(11) |
Oct
(30) |
Nov
(28) |
Dec
(39) |
2012 |
Jan
(38) |
Feb
(18) |
Mar
(43) |
Apr
(91) |
May
(108) |
Jun
(46) |
Jul
(37) |
Aug
(44) |
Sep
(33) |
Oct
(29) |
Nov
(36) |
Dec
(15) |
2013 |
Jan
(35) |
Feb
(611) |
Mar
(5) |
Apr
(55) |
May
(30) |
Jun
(28) |
Jul
(458) |
Aug
(34) |
Sep
(9) |
Oct
(39) |
Nov
(22) |
Dec
(32) |
2014 |
Jan
(16) |
Feb
(16) |
Mar
(42) |
Apr
(179) |
May
(7) |
Jun
(6) |
Jul
(9) |
Aug
|
Sep
(4) |
Oct
|
Nov
(3) |
Dec
|
2015 |
Jan
|
Feb
|
Mar
|
Apr
(2) |
May
(4) |
Jun
|
Jul
|
Aug
|
Sep
|
Oct
|
Nov
|
Dec
|
S | M | T | W | T | F | S |
---|---|---|---|---|---|---|
|
|
|
1
|
2
|
3
|
4
|
5
|
6
(1) |
7
|
8
|
9
|
10
|
11
|
12
|
13
|
14
(1) |
15
|
16
|
17
|
18
|
19
|
20
|
21
|
22
(1) |
23
|
24
|
25
|
26
(1) |
27
(1) |
28
|
29
|
30
|
|
|
From: mason_s <ma...@us...> - 2010-09-27 05:18:13
|
Project "Postgres-XC". The branch, master has been updated via e4978385ac1e81be3b95fe51656a0a166cfc22fb (commit) from c3e87d496dbf75651197f03b36d1cf0ba4ea7f0c (commit) - Log ----------------------------------------------------------------- commit e4978385ac1e81be3b95fe51656a0a166cfc22fb Author: Mason Sharp <ma...@us...> Date: Mon Sep 27 14:10:48 2010 +0900 Handle stored functions in queries. If the stored function is IMMUTABLE and appears in a query, it can be safely executed on the data nodes and is pushed down. Otherwise, the stored function must be executed on the coordinator. Note that stored functions cannot yet contain queries that use passed in parameters until we add support for prepared statements with parameters (planned to be done within the next few months). diff --git a/src/backend/pgxc/plan/planner.c b/src/backend/pgxc/plan/planner.c index a7bc0ab..a88179b 100644 --- a/src/backend/pgxc/plan/planner.c +++ b/src/backend/pgxc/plan/planner.c @@ -33,6 +33,7 @@ #include "parser/parse_coerce.h" #include "pgxc/locator.h" #include "pgxc/planner.h" +#include "tcop/pquery.h" #include "utils/acl.h" #include "utils/builtins.h" #include "utils/fmgroids.h" @@ -139,7 +140,6 @@ bool StrictStatementChecking = true; /* Forbid multi-node SELECT statements with an ORDER BY clause */ bool StrictSelectChecking = false; - static ExecNodes *get_plan_nodes(Query *query, bool isRead); static bool get_plan_nodes_walker(Node *query_node, XCWalkerContext *context); static bool examine_conditions_walker(Node *expr_node, XCWalkerContext *context); @@ -507,8 +507,9 @@ get_plan_nodes_insert(Query *query) * Get list of parent-child joins (partitioned together) * Get list of joins with replicated tables * - * If we encounter a cross-node join, we stop processing and return false, - * otherwise true. + * If we encounter an expression such as a cross-node join that cannot + * be easily handled in a single step, we stop processing and return true, + * otherwise false. * */ static bool @@ -780,6 +781,13 @@ examine_conditions_walker(Node *expr_node, XCWalkerContext *context) } } + /* See if the function is immutable, otherwise give up */ + if (IsA(expr_node, FuncExpr)) + { + if (!is_immutable_func(((FuncExpr*) expr_node)->funcid)) + return true; + } + /* Handle subquery */ if (IsA(expr_node, SubLink)) { @@ -2088,12 +2096,11 @@ pgxc_planner(Query *query, int cursorOptions, ParamListInfo boundParams) result->canSetTag = query->canSetTag; result->utilityStmt = query->utilityStmt; result->intoClause = query->intoClause; - result->rtable = query->rtable; query_step = makeNode(RemoteQuery); - query_step->is_single_step = false; + /* * Declare Cursor case: * We should leave as a step query only SELECT statement @@ -2210,6 +2217,13 @@ pgxc_planner(Query *query, int cursorOptions, ParamListInfo boundParams) return result; } + /* + * If there already is an active portal, we may be doing planning within a function. + * Just use the standard plan + */ + if (ActivePortal) + return standard_planner(query, cursorOptions, boundParams); + query_step->is_single_step = true; /* * PGXCTODO diff --git a/src/backend/pgxc/pool/postgresql_fdw.c b/src/backend/pgxc/pool/postgresql_fdw.c index 9e418be..dabf5da 100644 --- a/src/backend/pgxc/pool/postgresql_fdw.c +++ b/src/backend/pgxc/pool/postgresql_fdw.c @@ -44,7 +44,7 @@ /* deparse SQL from the request */ -static bool is_immutable_func(Oid funcid); +bool is_immutable_func(Oid funcid); static bool is_foreign_qual(ExprState *state); static bool foreign_qual_walker(Node *node, void *context); char *deparseSql(RemoteQueryState *scanstate); @@ -53,7 +53,7 @@ char *deparseSql(RemoteQueryState *scanstate); /* * Check whether the function is IMMUTABLE. */ -static bool +bool is_immutable_func(Oid funcid) { HeapTuple tp; diff --git a/src/include/pgxc/planner.h b/src/include/pgxc/planner.h index 548e4cd..d2bac5a 100644 --- a/src/include/pgxc/planner.h +++ b/src/include/pgxc/planner.h @@ -148,4 +148,5 @@ extern PlannedStmt *pgxc_planner(Query *query, int cursorOptions, ParamListInfo boundParams); extern bool IsHashDistributable(Oid col_type); +extern bool is_immutable_func(Oid funcid); #endif /* PGXCPLANNER_H */ ----------------------------------------------------------------------- Summary of changes: src/backend/pgxc/plan/planner.c | 24 +++++++++++++++++++----- src/backend/pgxc/pool/postgresql_fdw.c | 4 ++-- src/include/pgxc/planner.h | 1 + 3 files changed, 22 insertions(+), 7 deletions(-) hooks/post-receive -- Postgres-XC |