aboutsummaryrefslogtreecommitdiff
path: root/src/include
diff options
context:
space:
mode:
Diffstat (limited to 'src/include')
-rw-r--r--src/include/access/heapam.h6
-rw-r--r--src/include/catalog/heap.h11
-rw-r--r--src/include/executor/executor.h3
-rw-r--r--src/include/executor/nodeMaterial.h9
-rw-r--r--src/include/nodes/execnodes.h11
-rw-r--r--src/include/nodes/nodes.h10
-rw-r--r--src/include/nodes/plannodes.h25
-rw-r--r--src/include/optimizer/internal.h54
-rw-r--r--src/include/optimizer/planmain.h9
-rw-r--r--src/include/utils/rel.h3
-rw-r--r--src/include/utils/tuplestore.h60
11 files changed, 89 insertions, 112 deletions
diff --git a/src/include/access/heapam.h b/src/include/access/heapam.h
index dae57528c71..9880d2aa321 100644
--- a/src/include/access/heapam.h
+++ b/src/include/access/heapam.h
@@ -7,7 +7,7 @@
* Portions Copyright (c) 1996-2000, PostgreSQL, Inc
* Portions Copyright (c) 1994, Regents of the University of California
*
- * $Id: heapam.h,v 1.52 2000/04/12 17:16:25 momjian Exp $
+ * $Id: heapam.h,v 1.53 2000/06/18 22:44:23 tgl Exp $
*
*-------------------------------------------------------------------------
*/
@@ -242,9 +242,11 @@ extern HeapAccessStatistics heap_access_stats; /* in stats.c */
/* ----------------
* function prototypes for heap access method
+ *
+ * heap_create, heap_create_with_catalog, and heap_drop_with_catalog
+ * are declared in catalog/heap.h
* ----------------
*/
-/* heap_create, heap_creatr, and heap_destroy are declared in catalog/heap.h */
/* heapam.c */
diff --git a/src/include/catalog/heap.h b/src/include/catalog/heap.h
index 468eef4d3df..c59509e1529 100644
--- a/src/include/catalog/heap.h
+++ b/src/include/catalog/heap.h
@@ -7,7 +7,7 @@
* Portions Copyright (c) 1996-2000, PostgreSQL, Inc
* Portions Copyright (c) 1994, Regents of the University of California
*
- * $Id: heap.h,v 1.29 2000/04/12 17:16:27 momjian Exp $
+ * $Id: heap.h,v 1.30 2000/06/18 22:44:25 tgl Exp $
*
*-------------------------------------------------------------------------
*/
@@ -24,8 +24,9 @@ typedef struct RawColumnDefault
} RawColumnDefault;
extern Oid RelnameFindRelid(const char *relname);
-extern Relation heap_create(char *relname, TupleDesc att,
- bool isnoname, bool istemp, bool storage_create);
+
+extern Relation heap_create(char *relname, TupleDesc tupDesc,
+ bool istemp, bool storage_create);
extern bool heap_storage_create(Relation rel);
extern Oid heap_create_with_catalog(char *relname, TupleDesc tupdesc,
@@ -33,13 +34,9 @@ extern Oid heap_create_with_catalog(char *relname, TupleDesc tupdesc,
extern void heap_drop_with_catalog(const char *relname);
extern void heap_truncate(char *relname);
-extern void heap_drop(Relation rel);
extern void AddRelationRawConstraints(Relation rel,
List *rawColDefaults,
List *rawConstraints);
-extern void InitNoNameRelList(void);
-extern void DropNoNameRels(void);
-
#endif /* HEAP_H */
diff --git a/src/include/executor/executor.h b/src/include/executor/executor.h
index 6d196eb5a2c..703c907e127 100644
--- a/src/include/executor/executor.h
+++ b/src/include/executor/executor.h
@@ -7,7 +7,7 @@
* Portions Copyright (c) 1996-2000, PostgreSQL, Inc
* Portions Copyright (c) 1994, Regents of the University of California
*
- * $Id: executor.h,v 1.44 2000/06/17 21:48:56 tgl Exp $
+ * $Id: executor.h,v 1.45 2000/06/18 22:44:28 tgl Exp $
*
*-------------------------------------------------------------------------
*/
@@ -39,7 +39,6 @@ extern HeapScanDesc ExecReScanR(Relation relDesc, HeapScanDesc scanDesc,
ScanDirection direction, int nkeys, ScanKey skeys);
extern void ExecMarkPos(Plan *node);
extern void ExecRestrPos(Plan *node);
-extern Relation ExecCreatR(TupleDesc tupType, Oid relationOid);
/*
* prototypes from functions in execJunk.c
diff --git a/src/include/executor/nodeMaterial.h b/src/include/executor/nodeMaterial.h
index 1daf0bd0afe..b99d54b78d8 100644
--- a/src/include/executor/nodeMaterial.h
+++ b/src/include/executor/nodeMaterial.h
@@ -7,7 +7,7 @@
* Portions Copyright (c) 1996-2000, PostgreSQL, Inc
* Portions Copyright (c) 1994, Regents of the University of California
*
- * $Id: nodeMaterial.h,v 1.12 2000/01/26 05:58:05 momjian Exp $
+ * $Id: nodeMaterial.h,v 1.13 2000/06/18 22:44:28 tgl Exp $
*
*-------------------------------------------------------------------------
*/
@@ -20,11 +20,8 @@ extern TupleTableSlot *ExecMaterial(Material *node);
extern bool ExecInitMaterial(Material *node, EState *estate, Plan *parent);
extern int ExecCountSlotsMaterial(Material *node);
extern void ExecEndMaterial(Material *node);
-extern void ExecMaterialReScan(Material *node, ExprContext *exprCtxt, Plan *parent);
-
-#ifdef NOT_USED
-extern List ExecMaterialMarkPos(Material *node);
+extern void ExecMaterialMarkPos(Material *node);
extern void ExecMaterialRestrPos(Material *node);
+extern void ExecMaterialReScan(Material *node, ExprContext *exprCtxt, Plan *parent);
-#endif
#endif /* NODEMATERIAL_H */
diff --git a/src/include/nodes/execnodes.h b/src/include/nodes/execnodes.h
index 044cee23eab..a74f16348d2 100644
--- a/src/include/nodes/execnodes.h
+++ b/src/include/nodes/execnodes.h
@@ -7,7 +7,7 @@
* Portions Copyright (c) 1996-2000, PostgreSQL, Inc
* Portions Copyright (c) 1994, Regents of the University of California
*
- * $Id: execnodes.h,v 1.41 2000/04/12 17:16:39 momjian Exp $
+ * $Id: execnodes.h,v 1.42 2000/06/18 22:44:29 tgl Exp $
*
*-------------------------------------------------------------------------
*/
@@ -565,11 +565,9 @@ typedef struct HashJoinState
* MaterialState information
*
* materialize nodes are used to materialize the results
- * of a subplan into a temporary relation.
+ * of a subplan into a temporary file.
*
- * Flag indicated whether subplan has been materialized
- * TempRelation temporary relation containing result of executing
- * the subplan.
+ * tuplestorestate private state of tuplestore.c
*
* CommonScanState information
*
@@ -590,8 +588,7 @@ typedef struct HashJoinState
typedef struct MaterialState
{
CommonScanState csstate; /* its first field is NodeTag */
- bool mat_Flag;
- Relation mat_TempRelation;
+ void *tuplestorestate;
} MaterialState;
/* ---------------------
diff --git a/src/include/nodes/nodes.h b/src/include/nodes/nodes.h
index 5d049dadfb2..3be48317789 100644
--- a/src/include/nodes/nodes.h
+++ b/src/include/nodes/nodes.h
@@ -7,7 +7,7 @@
* Portions Copyright (c) 1996-2000, PostgreSQL, Inc
* Portions Copyright (c) 1994, Regents of the University of California
*
- * $Id: nodes.h,v 1.68 2000/05/29 01:59:12 tgl Exp $
+ * $Id: nodes.h,v 1.69 2000/06/18 22:44:31 tgl Exp $
*
*-------------------------------------------------------------------------
*/
@@ -39,13 +39,13 @@ typedef enum NodeTag
T_NestLoop,
T_MergeJoin,
T_HashJoin,
- T_Noname,
+ T_Noname_XXX, /* not used anymore; this tag# is available */
T_Material,
T_Sort,
T_Agg,
T_Unique,
T_Hash,
- T_Choose,
+ T_Choose_XXX, /* not used anymore; this tag# is available */
T_Group,
T_SubPlan,
T_TidScan,
@@ -261,10 +261,6 @@ typedef struct Node
(IsA(jp, Join) || IsA(jp, NestLoop) || \
IsA(jp, MergeJoin) || IsA(jp, HashJoin))
-#define IsA_Noname(t) \
- (IsA(t, Noname) || IsA(t, Material) || IsA(t, Sort) || \
- IsA(t, Unique))
-
#define IsA_Value(t) \
(IsA(t, Integer) || IsA(t, Float) || IsA(t, String))
diff --git a/src/include/nodes/plannodes.h b/src/include/nodes/plannodes.h
index 1cab6e03fc0..37006e621f4 100644
--- a/src/include/nodes/plannodes.h
+++ b/src/include/nodes/plannodes.h
@@ -7,7 +7,7 @@
* Portions Copyright (c) 1996-2000, PostgreSQL, Inc
* Portions Copyright (c) 1994, Regents of the University of California
*
- * $Id: plannodes.h,v 1.39 2000/04/12 17:16:40 momjian Exp $
+ * $Id: plannodes.h,v 1.40 2000/06/18 22:44:31 tgl Exp $
*
*-------------------------------------------------------------------------
*/
@@ -277,27 +277,13 @@ typedef struct Group
GroupState *grpstate;
} Group;
-/*
- * ==========
- * Noname nodes
- * ==========
- */
-typedef struct Noname
-{
- Plan plan;
- Oid nonameid;
- int keycount;
-} Noname;
-
/* ----------------
* materialization node
* ----------------
*/
typedef struct Material
{
- Plan plan; /* noname node flattened out */
- Oid nonameid;
- int keycount;
+ Plan plan;
MaterialState *matstate;
} Material;
@@ -307,8 +293,7 @@ typedef struct Material
*/
typedef struct Sort
{
- Plan plan; /* noname node flattened out */
- Oid nonameid;
+ Plan plan;
int keycount;
SortState *sortstate;
} Sort;
@@ -319,9 +304,7 @@ typedef struct Sort
*/
typedef struct Unique
{
- Plan plan; /* noname node flattened out */
- Oid nonameid;
- int keycount;
+ Plan plan;
int numCols; /* number of columns to check for
* uniqueness */
AttrNumber *uniqColIdx; /* indexes into the target list */
diff --git a/src/include/optimizer/internal.h b/src/include/optimizer/internal.h
deleted file mode 100644
index e9b0c8e4bc1..00000000000
--- a/src/include/optimizer/internal.h
+++ /dev/null
@@ -1,54 +0,0 @@
-/*-------------------------------------------------------------------------
- *
- * internal.h
- * Definitions required throughout the query optimizer.
- *
- *
- * Portions Copyright (c) 1996-2000, PostgreSQL, Inc
- * Portions Copyright (c) 1994, Regents of the University of California
- *
- * $Id: internal.h,v 1.27 2000/06/15 03:32:51 momjian Exp $
- *
- *-------------------------------------------------------------------------
- */
-#ifndef INTERNAL_H
-#define INTERNAL_H
-
-/*
- * ---------- SHARED MACROS
- *
- * Macros common to modules for creating, accessing, and modifying
- * query tree and query plan components.
- * Shared with the executor.
- *
- */
-
-
-/*
- * Size estimates
- *
- */
-
-/* The cost of sequentially scanning a materialized temporary relation
- */
-#define _NONAME_SCAN_COST_ 10
-
-/* The number of pages and tuples in a materialized relation
- */
-#define _NONAME_RELATION_PAGES_ 1
-#define _NONAME_RELATION_TUPLES_ 10
-
-/* The length of a variable-length field in bytes (stupid estimate...)
- */
-#define _DEFAULT_ATTRIBUTE_WIDTH_ 12
-
-/*
- * Flags and identifiers
- *
- */
-
-/* Identifier for (sort) temp relations */
-/* used to be -1 */
-#define _NONAME_RELATION_ID_ InvalidOid
-
-#endif /* INTERNAL_H */
diff --git a/src/include/optimizer/planmain.h b/src/include/optimizer/planmain.h
index e76ba201449..6c16364f67e 100644
--- a/src/include/optimizer/planmain.h
+++ b/src/include/optimizer/planmain.h
@@ -7,7 +7,7 @@
* Portions Copyright (c) 1996-2000, PostgreSQL, Inc
* Portions Copyright (c) 1994, Regents of the University of California
*
- * $Id: planmain.h,v 1.41 2000/06/08 22:37:51 momjian Exp $
+ * $Id: planmain.h,v 1.42 2000/06/18 22:44:33 tgl Exp $
*
*-------------------------------------------------------------------------
*/
@@ -27,12 +27,13 @@ extern Plan *query_planner(Query *root, List *tlist, List *qual,
* prototypes for plan/createplan.c
*/
extern Plan *create_plan(Query *root, Path *best_path);
-extern Sort *make_sort(List *tlist, Oid nonameid, Plan *lefttree,
- int keycount);
+extern Sort *make_sort(List *tlist, Plan *lefttree, int keycount);
+extern Sort *make_sort_from_pathkeys(List *tlist, Plan *lefttree,
+ List *pathkeys);
extern Agg *make_agg(List *tlist, List *qual, Plan *lefttree);
extern Group *make_group(List *tlist, bool tuplePerGroup, int ngrp,
AttrNumber *grpColIdx, Plan *lefttree);
-extern Noname *make_noname(List *tlist, List *pathkeys, Plan *subplan);
+extern Material *make_material(List *tlist, Plan *lefttree);
extern Unique *make_unique(List *tlist, Plan *lefttree, List *distinctList);
extern Result *make_result(List *tlist, Node *resconstantqual, Plan *subplan);
diff --git a/src/include/utils/rel.h b/src/include/utils/rel.h
index 2a585c0e7ea..901020611ac 100644
--- a/src/include/utils/rel.h
+++ b/src/include/utils/rel.h
@@ -7,7 +7,7 @@
* Portions Copyright (c) 1996-2000, PostgreSQL, Inc
* Portions Copyright (c) 1994, Regents of the University of California
*
- * $Id: rel.h,v 1.37 2000/06/17 21:49:02 tgl Exp $
+ * $Id: rel.h,v 1.38 2000/06/18 22:44:34 tgl Exp $
*
*-------------------------------------------------------------------------
*/
@@ -90,7 +90,6 @@ typedef struct RelationData
uint16 rd_refcnt; /* reference count */
bool rd_myxactonly; /* rel uses the local buffer mgr */
bool rd_isnailed; /* rel is nailed in cache */
- bool rd_isnoname; /* rel has no name */
bool rd_unlinked; /* rel already unlinked or not created yet */
bool rd_indexfound; /* true if rd_indexlist is valid */
Form_pg_am rd_am; /* AM tuple */
diff --git a/src/include/utils/tuplestore.h b/src/include/utils/tuplestore.h
new file mode 100644
index 00000000000..702d3b73c91
--- /dev/null
+++ b/src/include/utils/tuplestore.h
@@ -0,0 +1,60 @@
+/*-------------------------------------------------------------------------
+ *
+ * tuplestore.h
+ * Generalized routines for temporary tuple storage.
+ *
+ * This module handles temporary storage of tuples for purposes such
+ * as Materialize nodes, hashjoin batch files, etc. It is essentially
+ * a dumbed-down version of tuplesort.c; it does no sorting of tuples
+ * but can only store a sequence of tuples and regurgitate it later.
+ * A temporary file is used to handle the data if it exceeds the
+ * space limit specified by the caller.
+ *
+ * Portions Copyright (c) 1996-2000, PostgreSQL, Inc
+ * Portions Copyright (c) 1994, Regents of the University of California
+ *
+ * $Id: tuplestore.h,v 1.1 2000/06/18 22:44:35 tgl Exp $
+ *
+ *-------------------------------------------------------------------------
+ */
+#ifndef TUPLESTORE_H
+#define TUPLESTORE_H
+
+#include "access/htup.h"
+
+/* Tuplestorestate is an opaque type whose details are not known outside
+ * tuplestore.c.
+ */
+typedef struct Tuplestorestate Tuplestorestate;
+
+/*
+ * Currently we only need to store HeapTuples, but it would be easy
+ * to support the same behavior for IndexTuples and/or bare Datums.
+ */
+
+extern Tuplestorestate *tuplestore_begin_heap(bool randomAccess,
+ int maxKBytes);
+
+extern void tuplestore_puttuple(Tuplestorestate *state, void *tuple);
+
+extern void tuplestore_donestoring(Tuplestorestate *state);
+
+extern void *tuplestore_gettuple(Tuplestorestate *state, bool forward,
+ bool *should_free);
+
+#define tuplestore_getheaptuple(state, forward, should_free) \
+ ((HeapTuple) tuplestore_gettuple(state, forward, should_free))
+
+extern void tuplestore_end(Tuplestorestate *state);
+
+/*
+ * These routines may only be called if randomAccess was specified 'true'.
+ * Likewise, backwards scan in gettuple/getdatum is only allowed if
+ * randomAccess was specified.
+ */
+
+extern void tuplestore_rescan(Tuplestorestate *state);
+extern void tuplestore_markpos(Tuplestorestate *state);
+extern void tuplestore_restorepos(Tuplestorestate *state);
+
+#endif /* TUPLESTORE_H */