1
0
mirror of https://github.com/postgres/postgres.git synced 2025-10-27 00:12:01 +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:
Tom Lane
2000-09-29 18:21:41 +00:00
parent 6f64c2e54a
commit 3a94e789f5
77 changed files with 3176 additions and 2661 deletions

View File

@@ -7,7 +7,7 @@
* Portions Copyright (c) 1996-2000, PostgreSQL, Inc
* Portions Copyright (c) 1994, Regents of the University of California
*
* $Id: clauses.h,v 1.39 2000/09/12 21:07:11 tgl Exp $
* $Id: clauses.h,v 1.40 2000/09/29 18:21:40 tgl Exp $
*
*-------------------------------------------------------------------------
*/
@@ -43,6 +43,7 @@ extern Expr *get_notclausearg(Expr *notclause);
extern bool and_clause(Node *clause);
extern Expr *make_andclause(List *andclauses);
extern Node *make_and_qual(Node *qual1, Node *qual2);
extern Expr *make_ands_explicit(List *andclauses);
extern List *make_ands_implicit(Expr *clause);
@@ -56,10 +57,7 @@ extern void check_subplans_for_ungrouped_vars(Node *clause, Query *query);
extern bool contain_noncachable_functions(Node *clause);
extern bool is_pseudo_constant_clause(Node *clause);
extern List *pull_constant_clauses(List *quals,
List **noncachableQual,
List **constantQual);
extern List *pull_constant_clauses(List *quals, List **constantQual);
extern void clause_get_relids_vars(Node *clause, Relids *relids, List **vars);
extern int NumRelids(Node *clause);

View File

@@ -1,13 +1,13 @@
/*-------------------------------------------------------------------------
*
* pathnode.h
* prototypes for pathnode.c, indexnode.c, relnode.c.
* prototypes for pathnode.c, relnode.c.
*
*
* Portions Copyright (c) 1996-2000, PostgreSQL, Inc
* Portions Copyright (c) 1994, Regents of the University of California
*
* $Id: pathnode.h,v 1.28 2000/09/12 21:07:11 tgl Exp $
* $Id: pathnode.h,v 1.29 2000/09/29 18:21:40 tgl Exp $
*
*-------------------------------------------------------------------------
*/
@@ -32,6 +32,7 @@ extern IndexPath *create_index_path(Query *root, RelOptInfo *rel,
List *restriction_clauses,
ScanDirection indexscandir);
extern TidPath *create_tidscan_path(RelOptInfo *rel, List *tideval);
extern Path *create_subqueryscan_path(RelOptInfo *rel);
extern NestPath *create_nestloop_path(RelOptInfo *joinrel,
JoinType jointype,
@@ -66,9 +67,4 @@ extern RelOptInfo *get_join_rel(Query *root, RelOptInfo *outer_rel,
RelOptInfo *inner_rel,
List **restrictlist_ptr);
/*
* prototypes for indexnode.h
*/
extern List *find_relation_indices(Query *root, RelOptInfo *rel);
#endif /* PATHNODE_H */

View File

@@ -8,7 +8,7 @@
* Portions Copyright (c) 1996-2000, PostgreSQL, Inc
* Portions Copyright (c) 1994, Regents of the University of California
*
* $Id: paths.h,v 1.47 2000/09/12 21:07:11 tgl Exp $
* $Id: paths.h,v 1.48 2000/09/29 18:21:40 tgl Exp $
*
*-------------------------------------------------------------------------
*/
@@ -28,6 +28,7 @@ extern bool enable_geqo;
extern int geqo_rels;
extern RelOptInfo *make_one_rel(Query *root);
extern RelOptInfo *make_fromexpr_rel(Query *root, FromExpr *from);
/*
* indxpath.c
@@ -77,7 +78,7 @@ extern List *make_rels_by_clause_joins(Query *root,
extern List *make_rels_by_clauseless_joins(Query *root,
RelOptInfo *old_rel,
List *other_rels);
extern RelOptInfo *make_rel_from_jointree(Query *root, Node *jtnode);
extern RelOptInfo *make_jointree_rel(Query *root, Node *jtnode);
/*
* pathkeys.c

View File

@@ -7,7 +7,7 @@
* Portions Copyright (c) 1996-2000, PostgreSQL, Inc
* Portions Copyright (c) 1994, Regents of the University of California
*
* $Id: plancat.h,v 1.19 2000/06/09 03:17:11 tgl Exp $
* $Id: plancat.h,v 1.20 2000/09/29 18:21:40 tgl Exp $
*
*-------------------------------------------------------------------------
*/
@@ -17,10 +17,10 @@
#include "nodes/relation.h"
extern void relation_info(Query *root, Index relid,
bool *hasindex, long *pages, double *tuples);
extern void relation_info(Oid relationObjectId,
bool *hasindex, long *pages, double *tuples);
extern List *find_secondary_indexes(Query *root, Index relid);
extern List *find_secondary_indexes(Oid relationObjectId);
extern List *find_inheritance_children(Oid inhparent);

View File

@@ -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.44 2000/09/12 21:07:11 tgl Exp $
* $Id: planmain.h,v 1.45 2000/09/29 18:21:40 tgl Exp $
*
*-------------------------------------------------------------------------
*/
@@ -40,8 +40,7 @@ extern Result *make_result(List *tlist, Node *resconstantqual, Plan *subplan);
* prototypes for plan/initsplan.c
*/
extern void build_base_rel_tlists(Query *root, List *tlist);
extern Relids add_join_quals_to_rels(Query *root, Node *jtnode);
extern void add_restrict_and_join_to_rels(Query *root, List *clauses);
extern Relids distribute_quals_to_rels(Query *root, Node *jtnode);
extern List *add_missing_rels_to_query(Query *root, Node *jtnode);
extern void process_implied_equality(Query *root, Node *item1, Node *item2,
Oid sortop1, Oid sortop2);