aboutsummaryrefslogtreecommitdiff
path: root/src/backend/nodes/copyfuncs.c
diff options
context:
space:
mode:
authorRobert Haas <rhaas@postgresql.org>2014-11-07 17:26:02 -0500
committerRobert Haas <rhaas@postgresql.org>2014-11-07 17:34:36 -0500
commit0b03e5951bf0a1a8868db13f02049cf686a82165 (patch)
tree3495ca06369ec694e68ac84ed19c296a74521f26 /src/backend/nodes/copyfuncs.c
parent7250d8535b11d6443a9b27299e586c3df0654302 (diff)
downloadpostgresql-0b03e5951bf0a1a8868db13f02049cf686a82165.tar.gz
postgresql-0b03e5951bf0a1a8868db13f02049cf686a82165.zip
Introduce custom path and scan providers.
This allows extension modules to define their own methods for scanning a relation, and get the core code to use them. It's unclear as yet how much use this capability will find, but we won't find out if we never commit it. KaiGai Kohei, reviewed at various times and in various levels of detail by Shigeru Hanada, Tom Lane, Andres Freund, Álvaro Herrera, and myself.
Diffstat (limited to 'src/backend/nodes/copyfuncs.c')
-rw-r--r--src/backend/nodes/copyfuncs.c26
1 files changed, 26 insertions, 0 deletions
diff --git a/src/backend/nodes/copyfuncs.c b/src/backend/nodes/copyfuncs.c
index 7b51d331777..e76b5b3f633 100644
--- a/src/backend/nodes/copyfuncs.c
+++ b/src/backend/nodes/copyfuncs.c
@@ -598,6 +598,29 @@ _copyForeignScan(const ForeignScan *from)
}
/*
+ * _copyCustomScan
+ */
+static CustomScan *
+_copyCustomScan(const CustomScan *from)
+{
+ CustomScan *newnode;
+
+ newnode = from->methods->CopyCustomScan(from);
+ Assert(nodeTag(newnode) == nodeTag(from));
+
+ CopyScanFields((const Scan *) from, (Scan *) newnode);
+ COPY_SCALAR_FIELD(flags);
+ /*
+ * NOTE: The method field of CustomScan is required to be a pointer
+ * to a static table of callback functions. So, we don't copy the
+ * table itself, just reference the original one.
+ */
+ COPY_SCALAR_FIELD(methods);
+
+ return newnode;
+}
+
+/*
* CopyJoinFields
*
* This function copies the fields of the Join node. It is used by
@@ -4043,6 +4066,9 @@ copyObject(const void *from)
case T_ForeignScan:
retval = _copyForeignScan(from);
break;
+ case T_CustomScan:
+ retval = _copyCustomScan(from);
+ break;
case T_Join:
retval = _copyJoin(from);
break;