mirror of
https://github.com/postgres/postgres.git
synced 2025-06-30 21:42:05 +03:00
Subselects in FROM clause, per ISO syntax: FROM (SELECT ...) [AS] alias.
(Don't forget that an alias is required.) Views reimplemented as expanding to subselect-in-FROM. Grouping, aggregates, DISTINCT in views actually work now (he says optimistically). No UNION support in subselects/views yet, but I have some ideas about that. Rule-related permissions checking moved out of rewriter and into executor. INITDB REQUIRED!
This commit is contained in:
@ -12,7 +12,7 @@
|
||||
*
|
||||
*
|
||||
* IDENTIFICATION
|
||||
* $Header: /cvsroot/pgsql/src/backend/executor/execProcnode.c,v 1.19 2000/08/13 02:50:03 tgl Exp $
|
||||
* $Header: /cvsroot/pgsql/src/backend/executor/execProcnode.c,v 1.20 2000/09/29 18:21:29 tgl Exp $
|
||||
*
|
||||
*-------------------------------------------------------------------------
|
||||
*/
|
||||
@ -90,6 +90,7 @@
|
||||
#include "executor/nodeSeqscan.h"
|
||||
#include "executor/nodeSort.h"
|
||||
#include "executor/nodeSubplan.h"
|
||||
#include "executor/nodeSubqueryscan.h"
|
||||
#include "executor/nodeUnique.h"
|
||||
#include "miscadmin.h"
|
||||
#include "tcop/tcopprot.h"
|
||||
@ -153,6 +154,15 @@ ExecInitNode(Plan *node, EState *estate, Plan *parent)
|
||||
result = ExecInitIndexScan((IndexScan *) node, estate, parent);
|
||||
break;
|
||||
|
||||
case T_TidScan:
|
||||
result = ExecInitTidScan((TidScan *) node, estate, parent);
|
||||
break;
|
||||
|
||||
case T_SubqueryScan:
|
||||
result = ExecInitSubqueryScan((SubqueryScan *) node, estate,
|
||||
parent);
|
||||
break;
|
||||
|
||||
/* ----------------
|
||||
* join nodes
|
||||
* ----------------
|
||||
@ -165,6 +175,14 @@ ExecInitNode(Plan *node, EState *estate, Plan *parent)
|
||||
result = ExecInitMergeJoin((MergeJoin *) node, estate, parent);
|
||||
break;
|
||||
|
||||
case T_Hash:
|
||||
result = ExecInitHash((Hash *) node, estate, parent);
|
||||
break;
|
||||
|
||||
case T_HashJoin:
|
||||
result = ExecInitHashJoin((HashJoin *) node, estate, parent);
|
||||
break;
|
||||
|
||||
/* ----------------
|
||||
* materialization nodes
|
||||
* ----------------
|
||||
@ -189,18 +207,6 @@ ExecInitNode(Plan *node, EState *estate, Plan *parent)
|
||||
result = ExecInitAgg((Agg *) node, estate, parent);
|
||||
break;
|
||||
|
||||
case T_Hash:
|
||||
result = ExecInitHash((Hash *) node, estate, parent);
|
||||
break;
|
||||
|
||||
case T_HashJoin:
|
||||
result = ExecInitHashJoin((HashJoin *) node, estate, parent);
|
||||
break;
|
||||
|
||||
case T_TidScan:
|
||||
result = ExecInitTidScan((TidScan *) node, estate, parent);
|
||||
break;
|
||||
|
||||
default:
|
||||
elog(ERROR, "ExecInitNode: node %d unsupported", nodeTag(node));
|
||||
result = FALSE;
|
||||
@ -272,6 +278,14 @@ ExecProcNode(Plan *node, Plan *parent)
|
||||
result = ExecIndexScan((IndexScan *) node);
|
||||
break;
|
||||
|
||||
case T_TidScan:
|
||||
result = ExecTidScan((TidScan *) node);
|
||||
break;
|
||||
|
||||
case T_SubqueryScan:
|
||||
result = ExecSubqueryScan((SubqueryScan *) node);
|
||||
break;
|
||||
|
||||
/* ----------------
|
||||
* join nodes
|
||||
* ----------------
|
||||
@ -284,6 +298,14 @@ ExecProcNode(Plan *node, Plan *parent)
|
||||
result = ExecMergeJoin((MergeJoin *) node);
|
||||
break;
|
||||
|
||||
case T_Hash:
|
||||
result = ExecHash((Hash *) node);
|
||||
break;
|
||||
|
||||
case T_HashJoin:
|
||||
result = ExecHashJoin((HashJoin *) node);
|
||||
break;
|
||||
|
||||
/* ----------------
|
||||
* materialization nodes
|
||||
* ----------------
|
||||
@ -308,18 +330,6 @@ ExecProcNode(Plan *node, Plan *parent)
|
||||
result = ExecAgg((Agg *) node);
|
||||
break;
|
||||
|
||||
case T_Hash:
|
||||
result = ExecHash((Hash *) node);
|
||||
break;
|
||||
|
||||
case T_HashJoin:
|
||||
result = ExecHashJoin((HashJoin *) node);
|
||||
break;
|
||||
|
||||
case T_TidScan:
|
||||
result = ExecTidScan((TidScan *) node);
|
||||
break;
|
||||
|
||||
default:
|
||||
elog(ERROR, "ExecProcNode: node %d unsupported", nodeTag(node));
|
||||
result = NULL;
|
||||
@ -356,6 +366,12 @@ ExecCountSlotsNode(Plan *node)
|
||||
case T_IndexScan:
|
||||
return ExecCountSlotsIndexScan((IndexScan *) node);
|
||||
|
||||
case T_TidScan:
|
||||
return ExecCountSlotsTidScan((TidScan *) node);
|
||||
|
||||
case T_SubqueryScan:
|
||||
return ExecCountSlotsSubqueryScan((SubqueryScan *) node);
|
||||
|
||||
/* ----------------
|
||||
* join nodes
|
||||
* ----------------
|
||||
@ -366,6 +382,12 @@ ExecCountSlotsNode(Plan *node)
|
||||
case T_MergeJoin:
|
||||
return ExecCountSlotsMergeJoin((MergeJoin *) node);
|
||||
|
||||
case T_Hash:
|
||||
return ExecCountSlotsHash((Hash *) node);
|
||||
|
||||
case T_HashJoin:
|
||||
return ExecCountSlotsHashJoin((HashJoin *) node);
|
||||
|
||||
/* ----------------
|
||||
* materialization nodes
|
||||
* ----------------
|
||||
@ -385,15 +407,6 @@ ExecCountSlotsNode(Plan *node)
|
||||
case T_Agg:
|
||||
return ExecCountSlotsAgg((Agg *) node);
|
||||
|
||||
case T_Hash:
|
||||
return ExecCountSlotsHash((Hash *) node);
|
||||
|
||||
case T_HashJoin:
|
||||
return ExecCountSlotsHashJoin((HashJoin *) node);
|
||||
|
||||
case T_TidScan:
|
||||
return ExecCountSlotsTidScan((TidScan *) node);
|
||||
|
||||
default:
|
||||
elog(ERROR, "ExecCountSlotsNode: node not yet supported: %d",
|
||||
nodeTag(node));
|
||||
@ -462,6 +475,14 @@ ExecEndNode(Plan *node, Plan *parent)
|
||||
ExecEndIndexScan((IndexScan *) node);
|
||||
break;
|
||||
|
||||
case T_TidScan:
|
||||
ExecEndTidScan((TidScan *) node);
|
||||
break;
|
||||
|
||||
case T_SubqueryScan:
|
||||
ExecEndSubqueryScan((SubqueryScan *) node);
|
||||
break;
|
||||
|
||||
/* ----------------
|
||||
* join nodes
|
||||
* ----------------
|
||||
@ -474,6 +495,14 @@ ExecEndNode(Plan *node, Plan *parent)
|
||||
ExecEndMergeJoin((MergeJoin *) node);
|
||||
break;
|
||||
|
||||
case T_Hash:
|
||||
ExecEndHash((Hash *) node);
|
||||
break;
|
||||
|
||||
case T_HashJoin:
|
||||
ExecEndHashJoin((HashJoin *) node);
|
||||
break;
|
||||
|
||||
/* ----------------
|
||||
* materialization nodes
|
||||
* ----------------
|
||||
@ -498,22 +527,6 @@ ExecEndNode(Plan *node, Plan *parent)
|
||||
ExecEndAgg((Agg *) node);
|
||||
break;
|
||||
|
||||
/* ----------------
|
||||
* XXX add hooks to these
|
||||
* ----------------
|
||||
*/
|
||||
case T_Hash:
|
||||
ExecEndHash((Hash *) node);
|
||||
break;
|
||||
|
||||
case T_HashJoin:
|
||||
ExecEndHashJoin((HashJoin *) node);
|
||||
break;
|
||||
|
||||
case T_TidScan:
|
||||
ExecEndTidScan((TidScan *) node);
|
||||
break;
|
||||
|
||||
default:
|
||||
elog(ERROR, "ExecEndNode: node %d unsupported", nodeTag(node));
|
||||
break;
|
||||
|
Reference in New Issue
Block a user