diff options
author | Robert Haas <rhaas@postgresql.org> | 2015-11-12 07:40:31 -0500 |
---|---|---|
committer | Robert Haas <rhaas@postgresql.org> | 2015-11-12 07:40:31 -0500 |
commit | a05dc4d7fd57d4ae084c1f0801973e5c1a1aa26e (patch) | |
tree | a439fca900eace722c121012691ddfb08750c7b4 /src/backend/nodes/readfuncs.c | |
parent | 39b9978d9cac34ad799a5fa3ff3846f3e0372b0a (diff) | |
download | postgresql-a05dc4d7fd57d4ae084c1f0801973e5c1a1aa26e.tar.gz postgresql-a05dc4d7fd57d4ae084c1f0801973e5c1a1aa26e.zip |
Provide readfuncs support for custom scans.
Commit a0d9f6e434bb56f7e5441b7988f3982feead33b3 added this support for
all other plan node types; this fills in the gap.
Since TextOutCustomScan complicates this and is pretty well useless,
remove it.
KaiGai Kohei, with some modifications by me.
Diffstat (limited to 'src/backend/nodes/readfuncs.c')
-rw-r--r-- | src/backend/nodes/readfuncs.c | 41 |
1 files changed, 41 insertions, 0 deletions
diff --git a/src/backend/nodes/readfuncs.c b/src/backend/nodes/readfuncs.c index 5e258c939f2..222e2ed3108 100644 --- a/src/backend/nodes/readfuncs.c +++ b/src/backend/nodes/readfuncs.c @@ -28,6 +28,7 @@ #include <math.h> +#include "fmgr.h" #include "nodes/parsenodes.h" #include "nodes/plannodes.h" #include "nodes/readfuncs.h" @@ -1807,6 +1808,44 @@ _readForeignScan(void) } /* + * _readCustomScan + */ +static CustomScan * +_readCustomScan(void) +{ + READ_LOCALS(CustomScan); + char *library_name; + char *symbol_name; + const CustomScanMethods *methods; + + ReadCommonScan(&local_node->scan); + + READ_UINT_FIELD(flags); + READ_NODE_FIELD(custom_plans); + READ_NODE_FIELD(custom_exprs); + READ_NODE_FIELD(custom_private); + READ_NODE_FIELD(custom_scan_tlist); + READ_BITMAPSET_FIELD(custom_relids); + + /* + * Reconstruction of methods using library and symbol name + */ + token = pg_strtok(&length); /* skip methods: */ + token = pg_strtok(&length); /* LibraryName */ + library_name = nullable_string(token, length); + token = pg_strtok(&length); /* SymbolName */ + symbol_name = nullable_string(token, length); + + methods = (const CustomScanMethods *) + load_external_function(library_name, symbol_name, true, NULL); + Assert(strcmp(methods->LibraryName, library_name) == 0 && + strcmp(methods->SymbolName, symbol_name) == 0); + local_node->methods = methods; + + READ_DONE(); +} + +/* * ReadCommonJoin * Assign the basic stuff of all nodes that inherit from Join */ @@ -2362,6 +2401,8 @@ parseNodeString(void) return_value = _readWorkTableScan(); else if (MATCH("FOREIGNSCAN", 11)) return_value = _readForeignScan(); + else if (MATCH("CUSTOMSCAN", 10)) + return_value = _readCustomScan(); else if (MATCH("JOIN", 4)) return_value = _readJoin(); else if (MATCH("NESTLOOP", 8)) |