mirror of
https://github.com/postgres/postgres.git
synced 2025-06-26 12:21:12 +03:00
Used modified version of indent that understands over 100 typedefs.
This commit is contained in:
@ -4,7 +4,7 @@
|
||||
*
|
||||
* Copyright (c) 1994, Regents of the University of California
|
||||
*
|
||||
* $Id: geqo_copy.c,v 1.3 1997/09/08 02:23:47 momjian Exp $
|
||||
* $Id: geqo_copy.c,v 1.4 1997/09/08 21:44:13 momjian Exp $
|
||||
*
|
||||
*-------------------------------------------------------------------------
|
||||
*/
|
||||
@ -56,7 +56,7 @@
|
||||
*
|
||||
*/
|
||||
void
|
||||
geqo_copy(Chromosome * chromo1, Chromosome * chromo2, int string_length)
|
||||
geqo_copy(Chromosome *chromo1, Chromosome *chromo2, int string_length)
|
||||
{
|
||||
int i;
|
||||
|
||||
|
@ -6,7 +6,7 @@
|
||||
* CX operator according to Oliver et al
|
||||
* (Proc 2nd Int'l Conf on GA's)
|
||||
*
|
||||
* $Id: geqo_cx.c,v 1.3 1997/09/08 02:23:49 momjian Exp $
|
||||
* $Id: geqo_cx.c,v 1.4 1997/09/08 21:44:15 momjian Exp $
|
||||
*
|
||||
*-------------------------------------------------------------------------
|
||||
*/
|
||||
@ -60,7 +60,7 @@
|
||||
* cycle crossover
|
||||
*/
|
||||
int
|
||||
cx(Gene * tour1, Gene * tour2, Gene * offspring, int num_gene, City * city_table)
|
||||
cx(Gene *tour1, Gene *tour2, Gene *offspring, int num_gene, City *city_table)
|
||||
{
|
||||
|
||||
int i,
|
||||
|
@ -3,7 +3,7 @@
|
||||
* geqo_erx.c--
|
||||
* edge recombination crossover [ER]
|
||||
*
|
||||
* $Id: geqo_erx.c,v 1.4 1997/09/08 02:23:52 momjian Exp $
|
||||
* $Id: geqo_erx.c,v 1.5 1997/09/08 21:44:16 momjian Exp $
|
||||
*
|
||||
*-------------------------------------------------------------------------
|
||||
*/
|
||||
@ -52,11 +52,11 @@
|
||||
#include "optimizer/geqo_random.h"
|
||||
|
||||
|
||||
static int gimme_edge(Gene gene1, Gene gene2, Edge * edge_table);
|
||||
static void remove_gene(Gene gene, Edge edge, Edge * edge_table);
|
||||
static Gene gimme_gene(Edge edge, Edge * edge_table);
|
||||
static int gimme_edge(Gene gene1, Gene gene2, Edge *edge_table);
|
||||
static void remove_gene(Gene gene, Edge edge, Edge *edge_table);
|
||||
static Gene gimme_gene(Edge edge, Edge *edge_table);
|
||||
|
||||
static Gene edge_failure(Gene * gene, int index, Edge * edge_table, int num_gene);
|
||||
static Gene edge_failure(Gene *gene, int index, Edge *edge_table, int num_gene);
|
||||
|
||||
|
||||
/* alloc_edge_table--
|
||||
@ -86,7 +86,7 @@ alloc_edge_table(int num_gene)
|
||||
*
|
||||
*/
|
||||
void
|
||||
free_edge_table(Edge * edge_table)
|
||||
free_edge_table(Edge *edge_table)
|
||||
{
|
||||
pfree(edge_table);
|
||||
}
|
||||
@ -105,7 +105,7 @@ free_edge_table(Edge * edge_table)
|
||||
*
|
||||
*/
|
||||
float
|
||||
gimme_edge_table(Gene * tour1, Gene * tour2, int num_gene, Edge * edge_table)
|
||||
gimme_edge_table(Gene *tour1, Gene *tour2, int num_gene, Edge *edge_table)
|
||||
{
|
||||
int i,
|
||||
index1,
|
||||
@ -165,7 +165,7 @@ gimme_edge_table(Gene * tour1, Gene * tour2, int num_gene, Edge * edge_table)
|
||||
* 0 if edge was already registered and edge_table is unchanged
|
||||
*/
|
||||
static int
|
||||
gimme_edge(Gene gene1, Gene gene2, Edge * edge_table)
|
||||
gimme_edge(Gene gene1, Gene gene2, Edge *edge_table)
|
||||
{
|
||||
int i;
|
||||
int edges;
|
||||
@ -207,7 +207,7 @@ gimme_edge(Gene gene1, Gene gene2, Edge * edge_table)
|
||||
*
|
||||
*/
|
||||
int
|
||||
gimme_tour(Edge * edge_table, Gene * new_gene, int num_gene)
|
||||
gimme_tour(Edge *edge_table, Gene *new_gene, int num_gene)
|
||||
{
|
||||
int i;
|
||||
int edge_failures = 0;
|
||||
@ -256,7 +256,7 @@ gimme_tour(Edge * edge_table, Gene * new_gene, int num_gene)
|
||||
*
|
||||
*/
|
||||
static void
|
||||
remove_gene(Gene gene, Edge edge, Edge * edge_table)
|
||||
remove_gene(Gene gene, Edge edge, Edge *edge_table)
|
||||
{
|
||||
int i,
|
||||
j;
|
||||
@ -298,7 +298,7 @@ remove_gene(Gene gene, Edge edge, Edge * edge_table)
|
||||
*
|
||||
*/
|
||||
static Gene
|
||||
gimme_gene(Edge edge, Edge * edge_table)
|
||||
gimme_gene(Edge edge, Edge *edge_table)
|
||||
{
|
||||
int i;
|
||||
Gene friend;
|
||||
@ -389,7 +389,7 @@ gimme_gene(Edge edge, Edge * edge_table)
|
||||
*
|
||||
*/
|
||||
static Gene
|
||||
edge_failure(Gene * gene, int index, Edge * edge_table, int num_gene)
|
||||
edge_failure(Gene *gene, int index, Edge *edge_table, int num_gene)
|
||||
{
|
||||
int i;
|
||||
Gene fail_gene = gene[index];
|
||||
|
@ -5,7 +5,7 @@
|
||||
*
|
||||
* Copyright (c) 1994, Regents of the University of California
|
||||
*
|
||||
* $Id: geqo_eval.c,v 1.14 1997/09/08 02:23:53 momjian Exp $
|
||||
* $Id: geqo_eval.c,v 1.15 1997/09/08 21:44:19 momjian Exp $
|
||||
*
|
||||
*-------------------------------------------------------------------------
|
||||
*/
|
||||
@ -50,13 +50,13 @@
|
||||
#include "optimizer/geqo_paths.h"
|
||||
|
||||
|
||||
static List *gimme_clause_joins(Query * root, Rel * outer_rel, Rel * inner_rel);
|
||||
static Rel *gimme_clauseless_join(Rel * outer_rel, Rel * inner_rel);
|
||||
static Rel *init_join_rel(Rel * outer_rel, Rel * inner_rel, JInfo * joininfo);
|
||||
static List *new_join_tlist(List * tlist, List * other_relids, int first_resdomno);
|
||||
static List *new_joininfo_list(List * joininfo_list, List * join_relids);
|
||||
static void geqo_joinrel_size(Rel * joinrel, Rel * outer_rel, Rel * inner_rel);
|
||||
static Rel *geqo_nth(int stop, List * rels);
|
||||
static List *gimme_clause_joins(Query *root, Rel *outer_rel, Rel *inner_rel);
|
||||
static Rel *gimme_clauseless_join(Rel *outer_rel, Rel *inner_rel);
|
||||
static Rel *init_join_rel(Rel *outer_rel, Rel *inner_rel, JInfo *joininfo);
|
||||
static List *new_join_tlist(List *tlist, List *other_relids, int first_resdomno);
|
||||
static List *new_joininfo_list(List *joininfo_list, List *join_relids);
|
||||
static void geqo_joinrel_size(Rel *joinrel, Rel *outer_rel, Rel *inner_rel);
|
||||
static Rel *geqo_nth(int stop, List *rels);
|
||||
|
||||
/*
|
||||
* geqo_eval--
|
||||
@ -64,7 +64,7 @@ static Rel *geqo_nth(int stop, List * rels);
|
||||
* Returns cost of a query tree as an individual of the population.
|
||||
*/
|
||||
Cost
|
||||
geqo_eval(Query * root, Gene * tour, int num_gene)
|
||||
geqo_eval(Query *root, Gene *tour, int num_gene)
|
||||
{
|
||||
Rel *joinrel;
|
||||
Cost fitness;
|
||||
@ -99,7 +99,7 @@ geqo_eval(Query * root, Gene * tour, int num_gene)
|
||||
* Returns a new join relation incorporating all joins in a left-sided tree.
|
||||
*/
|
||||
Rel *
|
||||
gimme_tree(Query * root, Gene * tour, int rel_count, int num_gene, Rel * outer_rel)
|
||||
gimme_tree(Query *root, Gene *tour, int rel_count, int num_gene, Rel *outer_rel)
|
||||
{
|
||||
Rel *inner_rel; /* current relation */
|
||||
int base_rel_index;
|
||||
@ -191,7 +191,7 @@ gimme_tree(Query * root, Gene * tour, int rel_count, int num_gene, Rel * outer_r
|
||||
*/
|
||||
|
||||
static List *
|
||||
gimme_clause_joins(Query * root, Rel * outer_rel, Rel * inner_rel)
|
||||
gimme_clause_joins(Query *root, Rel *outer_rel, Rel *inner_rel)
|
||||
{
|
||||
List *join_list = NIL;
|
||||
List *i = NIL;
|
||||
@ -244,7 +244,7 @@ gimme_clause_joins(Query * root, Rel * outer_rel, Rel * inner_rel)
|
||||
*/
|
||||
|
||||
static Rel *
|
||||
gimme_clauseless_join(Rel * outer_rel, Rel * inner_rel)
|
||||
gimme_clauseless_join(Rel *outer_rel, Rel *inner_rel)
|
||||
{
|
||||
return (init_join_rel(outer_rel, inner_rel, (JInfo *) NULL));
|
||||
}
|
||||
@ -261,7 +261,7 @@ gimme_clauseless_join(Rel * outer_rel, Rel * inner_rel)
|
||||
* Returns the new join relation node.
|
||||
*/
|
||||
static Rel *
|
||||
init_join_rel(Rel * outer_rel, Rel * inner_rel, JInfo * joininfo)
|
||||
init_join_rel(Rel *outer_rel, Rel *inner_rel, JInfo *joininfo)
|
||||
{
|
||||
Rel *joinrel = makeNode(Rel);
|
||||
List *joinrel_joininfo_list = NIL;
|
||||
@ -339,8 +339,8 @@ init_join_rel(Rel * outer_rel, Rel * inner_rel, JInfo * joininfo)
|
||||
* Returns the new target list.
|
||||
*/
|
||||
static List *
|
||||
new_join_tlist(List * tlist,
|
||||
List * other_relids,
|
||||
new_join_tlist(List *tlist,
|
||||
List *other_relids,
|
||||
int first_resdomno)
|
||||
{
|
||||
int resdomno = first_resdomno - 1;
|
||||
@ -389,7 +389,7 @@ new_join_tlist(List * tlist,
|
||||
* Returns a list of joininfo nodes, new and old.
|
||||
*/
|
||||
static List *
|
||||
new_joininfo_list(List * joininfo_list, List * join_relids)
|
||||
new_joininfo_list(List *joininfo_list, List *join_relids)
|
||||
{
|
||||
List *current_joininfo_list = NIL;
|
||||
List *new_otherrels = NIL;
|
||||
@ -454,7 +454,7 @@ new_joininfo_list(List * joininfo_list, List * join_relids)
|
||||
* Modifies the joininfo field of appropriate rel nodes.
|
||||
*/
|
||||
static void
|
||||
geqo_add_new_joininfos(Query * root, List * joinrels, List * outerrels)
|
||||
geqo_add_new_joininfos(Query *root, List *joinrels, List *outerrels)
|
||||
{
|
||||
List *xjoinrel = NIL;
|
||||
List *xrelid = NIL;
|
||||
@ -603,7 +603,7 @@ geqo_add_new_joininfos(Query * root, List * joinrels, List * outerrels)
|
||||
* Returns the list of final join relations.
|
||||
*/
|
||||
static List *
|
||||
geqo_final_join_rels(List * join_rel_list)
|
||||
geqo_final_join_rels(List *join_rel_list)
|
||||
{
|
||||
List *xrel = NIL;
|
||||
List *temp = NIL;
|
||||
@ -649,7 +649,7 @@ geqo_final_join_rels(List * join_rel_list)
|
||||
* Modifies the superrels field of rel
|
||||
*/
|
||||
static void
|
||||
add_superrels(Rel * rel, Rel * super_rel)
|
||||
add_superrels(Rel *rel, Rel *super_rel)
|
||||
{
|
||||
rel->superrels = lappend(rel->superrels, super_rel);
|
||||
}
|
||||
@ -664,13 +664,13 @@ add_superrels(Rel * rel, Rel * super_rel)
|
||||
* Returns non-nil if rel1 and rel2 do not overlap.
|
||||
*/
|
||||
static bool
|
||||
nonoverlap_rels(Rel * rel1, Rel * rel2)
|
||||
nonoverlap_rels(Rel *rel1, Rel *rel2)
|
||||
{
|
||||
return (nonoverlap_sets(rel1->relids, rel2->relids));
|
||||
}
|
||||
|
||||
static bool
|
||||
nonoverlap_sets(List * s1, List * s2)
|
||||
nonoverlap_sets(List *s1, List *s2)
|
||||
{
|
||||
List *x = NIL;
|
||||
|
||||
@ -692,7 +692,7 @@ nonoverlap_sets(List * s1, List * s2)
|
||||
* long join queries; so get logarithm of size when MAXINT overflow;
|
||||
*/
|
||||
static void
|
||||
geqo_joinrel_size(Rel * joinrel, Rel * outer_rel, Rel * inner_rel)
|
||||
geqo_joinrel_size(Rel *joinrel, Rel *outer_rel, Rel *inner_rel)
|
||||
{
|
||||
Cost temp;
|
||||
int ntuples;
|
||||
@ -726,7 +726,7 @@ geqo_log(double x, double b)
|
||||
}
|
||||
|
||||
static Rel *
|
||||
geqo_nth(int stop, List * rels)
|
||||
geqo_nth(int stop, List *rels)
|
||||
{
|
||||
List *r;
|
||||
int i = 1;
|
||||
|
@ -6,7 +6,7 @@
|
||||
*
|
||||
* Copyright (c) 1994, Regents of the University of California
|
||||
*
|
||||
* $Id: geqo_main.c,v 1.5 1997/09/08 02:23:55 momjian Exp $
|
||||
* $Id: geqo_main.c,v 1.6 1997/09/08 21:44:25 momjian Exp $
|
||||
*
|
||||
*-------------------------------------------------------------------------
|
||||
*/
|
||||
@ -64,7 +64,7 @@
|
||||
*/
|
||||
|
||||
Rel *
|
||||
geqo(Query * root)
|
||||
geqo(Query *root)
|
||||
{
|
||||
int generation;
|
||||
Chromosome *momma;
|
||||
|
@ -5,7 +5,7 @@
|
||||
*
|
||||
* Copyright (c) 1994, Regents of the University of California
|
||||
*
|
||||
* $Id: geqo_misc.c,v 1.4 1997/09/08 02:23:57 momjian Exp $
|
||||
* $Id: geqo_misc.c,v 1.5 1997/09/08 21:44:26 momjian Exp $
|
||||
*
|
||||
*-------------------------------------------------------------------------
|
||||
*/
|
||||
@ -41,13 +41,13 @@
|
||||
#include "optimizer/geqo_recombination.h"
|
||||
#include "optimizer/geqo_misc.h"
|
||||
|
||||
static float avg_pool(Pool * pool);
|
||||
static float avg_pool(Pool *pool);
|
||||
|
||||
/* avg_pool--
|
||||
*
|
||||
*/
|
||||
static float
|
||||
avg_pool(Pool * pool)
|
||||
avg_pool(Pool *pool)
|
||||
{
|
||||
int i;
|
||||
double cumulative = 0.0;
|
||||
@ -64,7 +64,7 @@ avg_pool(Pool * pool)
|
||||
/* print_pool--
|
||||
*/
|
||||
void
|
||||
print_pool(FILE * fp, Pool * pool, int start, int stop)
|
||||
print_pool(FILE *fp, Pool *pool, int start, int stop)
|
||||
{
|
||||
int i,
|
||||
j;
|
||||
@ -97,7 +97,7 @@ print_pool(FILE * fp, Pool * pool, int start, int stop)
|
||||
*
|
||||
*/
|
||||
void
|
||||
print_gen(FILE * fp, Pool * pool, int generation)
|
||||
print_gen(FILE *fp, Pool *pool, int generation)
|
||||
{
|
||||
int lowest;
|
||||
|
||||
@ -116,7 +116,7 @@ print_gen(FILE * fp, Pool * pool, int generation)
|
||||
|
||||
|
||||
void
|
||||
print_edge_table(FILE * fp, Edge * edge_table, int num_gene)
|
||||
print_edge_table(FILE *fp, Edge *edge_table, int num_gene)
|
||||
{
|
||||
int i,
|
||||
j;
|
||||
@ -139,10 +139,10 @@ print_edge_table(FILE * fp, Edge * edge_table, int num_gene)
|
||||
*************************************************************/
|
||||
|
||||
void
|
||||
geqo_print_joinclauses(Query * root, List * clauses)
|
||||
geqo_print_joinclauses(Query *root, List *clauses)
|
||||
{
|
||||
List *l;
|
||||
extern void print_expr(Node * expr, List * rtable); /* in print.c */
|
||||
extern void print_expr(Node *expr, List *rtable); /* in print.c */
|
||||
|
||||
foreach(l, clauses)
|
||||
{
|
||||
@ -155,7 +155,7 @@ geqo_print_joinclauses(Query * root, List * clauses)
|
||||
}
|
||||
|
||||
void
|
||||
geqo_print_path(Query * root, Path * path, int indent)
|
||||
geqo_print_path(Query *root, Path *path, int indent)
|
||||
{
|
||||
char *ptype = NULL;
|
||||
JoinPath *jp;
|
||||
@ -262,7 +262,7 @@ geqo_print_path(Query * root, Path * path, int indent)
|
||||
}
|
||||
|
||||
void
|
||||
geqo_print_rel(Query * root, Rel * rel)
|
||||
geqo_print_rel(Query *root, Rel *rel)
|
||||
{
|
||||
List *l;
|
||||
|
||||
|
@ -4,7 +4,7 @@
|
||||
*
|
||||
* TSP mutation routines
|
||||
*
|
||||
* $Id: geqo_mutation.c,v 1.3 1997/09/08 02:23:57 momjian Exp $
|
||||
* $Id: geqo_mutation.c,v 1.4 1997/09/08 21:44:27 momjian Exp $
|
||||
*
|
||||
*-------------------------------------------------------------------------
|
||||
*/
|
||||
@ -51,7 +51,7 @@
|
||||
#include "optimizer/geqo_mutation.h"
|
||||
|
||||
void
|
||||
geqo_mutation(Gene * tour, int num_gene)
|
||||
geqo_mutation(Gene *tour, int num_gene)
|
||||
{
|
||||
int swap1;
|
||||
int swap2;
|
||||
|
@ -6,7 +6,7 @@
|
||||
* OX1 operator according to Davis
|
||||
* (Proc Int'l Joint Conf on AI)
|
||||
*
|
||||
* $Id: geqo_ox1.c,v 1.3 1997/09/08 02:23:58 momjian Exp $
|
||||
* $Id: geqo_ox1.c,v 1.4 1997/09/08 21:44:28 momjian Exp $
|
||||
*
|
||||
*-------------------------------------------------------------------------
|
||||
*/
|
||||
@ -59,7 +59,7 @@
|
||||
* position crossover
|
||||
*/
|
||||
void
|
||||
ox1(Gene * tour1, Gene * tour2, Gene * offspring, int num_gene, City * city_table)
|
||||
ox1(Gene *tour1, Gene *tour2, Gene *offspring, int num_gene, City *city_table)
|
||||
{
|
||||
int left,
|
||||
right,
|
||||
|
@ -6,7 +6,7 @@
|
||||
* OX2 operator according to Syswerda
|
||||
* (The Genetic Algorithms Handbook, ed L Davis)
|
||||
*
|
||||
* $Id: geqo_ox2.c,v 1.3 1997/09/08 02:23:59 momjian Exp $
|
||||
* $Id: geqo_ox2.c,v 1.4 1997/09/08 21:44:29 momjian Exp $
|
||||
*
|
||||
*-------------------------------------------------------------------------
|
||||
*/
|
||||
@ -59,7 +59,7 @@
|
||||
* position crossover
|
||||
*/
|
||||
void
|
||||
ox2(Gene * tour1, Gene * tour2, Gene * offspring, int num_gene, City * city_table)
|
||||
ox2(Gene *tour1, Gene *tour2, Gene *offspring, int num_gene, City *city_table)
|
||||
{
|
||||
int k,
|
||||
j,
|
||||
|
@ -5,7 +5,7 @@
|
||||
*
|
||||
* Copyright (c) 1994, Regents of the University of California
|
||||
*
|
||||
* $Id: geqo_params.c,v 1.7 1997/09/08 02:24:00 momjian Exp $
|
||||
* $Id: geqo_params.c,v 1.8 1997/09/08 21:44:30 momjian Exp $
|
||||
*
|
||||
*-------------------------------------------------------------------------
|
||||
*/
|
||||
@ -270,7 +270,7 @@ geqo_params(int string_length)
|
||||
* other cases return 0.
|
||||
*/
|
||||
static int
|
||||
next_token(FILE * fp, char *buf, int bufsz)
|
||||
next_token(FILE *fp, char *buf, int bufsz)
|
||||
{
|
||||
int c;
|
||||
char *eb = buf + (bufsz - 1);
|
||||
|
@ -5,7 +5,7 @@
|
||||
*
|
||||
* Copyright (c) 1994, Regents of the University of California
|
||||
*
|
||||
* $Id: geqo_paths.c,v 1.6 1997/09/08 02:24:05 momjian Exp $
|
||||
* $Id: geqo_paths.c,v 1.7 1997/09/08 21:44:32 momjian Exp $
|
||||
*
|
||||
*-------------------------------------------------------------------------
|
||||
*/
|
||||
@ -28,8 +28,8 @@
|
||||
#include "optimizer/geqo_paths.h"
|
||||
|
||||
|
||||
static List *geqo_prune_rel(Rel * rel, List * other_rels);
|
||||
static Path *set_paths(Rel * rel, Path * unorderedpath);
|
||||
static List *geqo_prune_rel(Rel *rel, List *other_rels);
|
||||
static Path *set_paths(Rel *rel, Path *unorderedpath);
|
||||
|
||||
/*
|
||||
* geqo-prune-rels--
|
||||
@ -40,7 +40,7 @@ static Path *set_paths(Rel * rel, Path * unorderedpath);
|
||||
*
|
||||
*/
|
||||
List *
|
||||
geqo_prune_rels(List * rel_list)
|
||||
geqo_prune_rels(List *rel_list)
|
||||
{
|
||||
List *temp_list = NIL;
|
||||
|
||||
@ -65,7 +65,7 @@ geqo_prune_rels(List * rel_list)
|
||||
*
|
||||
*/
|
||||
static List *
|
||||
geqo_prune_rel(Rel * rel, List * other_rels)
|
||||
geqo_prune_rel(Rel *rel, List *other_rels)
|
||||
{
|
||||
List *i = NIL;
|
||||
List *t_list = NIL;
|
||||
@ -102,7 +102,7 @@ geqo_prune_rel(Rel * rel, List * other_rels)
|
||||
*
|
||||
*/
|
||||
void
|
||||
geqo_rel_paths(Rel * rel)
|
||||
geqo_rel_paths(Rel *rel)
|
||||
{
|
||||
List *y = NIL;
|
||||
Path *path = (Path *) NULL;
|
||||
@ -134,7 +134,7 @@ geqo_rel_paths(Rel * rel)
|
||||
*
|
||||
*/
|
||||
static Path *
|
||||
set_paths(Rel * rel, Path * unorderedpath)
|
||||
set_paths(Rel *rel, Path *unorderedpath)
|
||||
{
|
||||
Path *cheapest = set_cheapest(rel, rel->pathlist);
|
||||
|
||||
|
@ -6,7 +6,7 @@
|
||||
* PMX operator according to Goldberg & Lingle
|
||||
* (Proc Int'l Conf on GA's)
|
||||
*
|
||||
* $Id: geqo_pmx.c,v 1.3 1997/09/08 02:24:06 momjian Exp $
|
||||
* $Id: geqo_pmx.c,v 1.4 1997/09/08 21:44:33 momjian Exp $
|
||||
*
|
||||
*-------------------------------------------------------------------------
|
||||
*/
|
||||
@ -59,7 +59,7 @@
|
||||
* partially matched crossover
|
||||
*/
|
||||
void
|
||||
pmx(Gene * tour1, Gene * tour2, Gene * offspring, int num_gene)
|
||||
pmx(Gene *tour1, Gene *tour2, Gene *offspring, int num_gene)
|
||||
{
|
||||
int *failed = (int *) palloc((num_gene + 1) * sizeof(int));
|
||||
int *from = (int *) palloc((num_gene + 1) * sizeof(int));
|
||||
|
@ -5,7 +5,7 @@
|
||||
*
|
||||
* Copyright (c) 1994, Regents of the University of California
|
||||
*
|
||||
* $Id: geqo_pool.c,v 1.3 1997/09/08 02:24:06 momjian Exp $
|
||||
* $Id: geqo_pool.c,v 1.4 1997/09/08 21:44:34 momjian Exp $
|
||||
*
|
||||
*-------------------------------------------------------------------------
|
||||
*/
|
||||
@ -80,7 +80,7 @@ alloc_pool(int pool_size, int string_length)
|
||||
* deallocates memory for GA pool
|
||||
*/
|
||||
void
|
||||
free_pool(Pool * pool)
|
||||
free_pool(Pool *pool)
|
||||
{
|
||||
Chromosome *chromo;
|
||||
int i;
|
||||
@ -102,7 +102,7 @@ free_pool(Pool * pool)
|
||||
* initialize genetic pool
|
||||
*/
|
||||
void
|
||||
random_init_pool(Query * root, Pool * pool, int strt, int stp)
|
||||
random_init_pool(Query *root, Pool *pool, int strt, int stp)
|
||||
{
|
||||
Chromosome *chromo = (Chromosome *) pool->data;
|
||||
int i;
|
||||
@ -125,7 +125,7 @@ random_init_pool(Query * root, Pool * pool, int strt, int stp)
|
||||
* maybe you have to change compare() for different ordering ...
|
||||
*/
|
||||
void
|
||||
sort_pool(Pool * pool)
|
||||
sort_pool(Pool *pool)
|
||||
{
|
||||
pg_qsort(pool->data, pool->size, sizeof(Chromosome), compare);
|
||||
|
||||
@ -170,7 +170,7 @@ alloc_chromo(int string_length)
|
||||
* deallocates a chromosome and string space
|
||||
*/
|
||||
void
|
||||
free_chromo(Chromosome * chromo)
|
||||
free_chromo(Chromosome *chromo)
|
||||
{
|
||||
pfree(chromo->string);
|
||||
pfree(chromo);
|
||||
@ -181,7 +181,7 @@ free_chromo(Chromosome * chromo)
|
||||
* assumes best->worst = smallest->largest
|
||||
*/
|
||||
void
|
||||
spread_chromo(Chromosome * chromo, Pool * pool)
|
||||
spread_chromo(Chromosome *chromo, Pool *pool)
|
||||
{
|
||||
int top,
|
||||
mid,
|
||||
|
@ -6,7 +6,7 @@
|
||||
* PX operator according to Syswerda
|
||||
* (The Genetic Algorithms Handbook, L Davis, ed)
|
||||
*
|
||||
* $Id: geqo_px.c,v 1.3 1997/09/08 02:24:07 momjian Exp $
|
||||
* $Id: geqo_px.c,v 1.4 1997/09/08 21:44:35 momjian Exp $
|
||||
*
|
||||
*-------------------------------------------------------------------------
|
||||
*/
|
||||
@ -59,7 +59,7 @@
|
||||
* position crossover
|
||||
*/
|
||||
void
|
||||
px(Gene * tour1, Gene * tour2, Gene * offspring, int num_gene, City * city_table)
|
||||
px(Gene *tour1, Gene *tour2, Gene *offspring, int num_gene, City *city_table)
|
||||
{
|
||||
|
||||
int num_positions;
|
||||
|
@ -3,7 +3,7 @@
|
||||
* geqo_recombination.c--
|
||||
* misc recombination procedures
|
||||
*
|
||||
* $Id: geqo_recombination.c,v 1.3 1997/09/08 02:24:08 momjian Exp $
|
||||
* $Id: geqo_recombination.c,v 1.4 1997/09/08 21:44:36 momjian Exp $
|
||||
*
|
||||
*-------------------------------------------------------------------------
|
||||
*/
|
||||
@ -51,7 +51,7 @@
|
||||
*
|
||||
*/
|
||||
void
|
||||
init_tour(Gene * tour, int num_gene)
|
||||
init_tour(Gene *tour, int num_gene)
|
||||
{
|
||||
Gene *tmp;
|
||||
int remainder;
|
||||
@ -105,7 +105,7 @@ alloc_city_table(int num_gene)
|
||||
*
|
||||
*/
|
||||
void
|
||||
free_city_table(City * city_table)
|
||||
free_city_table(City *city_table)
|
||||
{
|
||||
pfree(city_table);
|
||||
}
|
||||
|
@ -5,7 +5,7 @@
|
||||
*
|
||||
* Copyright (c) 1994, Regents of the University of California
|
||||
*
|
||||
* $Id: geqo_selection.c,v 1.3 1997/09/08 02:24:08 momjian Exp $
|
||||
* $Id: geqo_selection.c,v 1.4 1997/09/08 21:44:41 momjian Exp $
|
||||
*
|
||||
*-------------------------------------------------------------------------
|
||||
*/
|
||||
@ -63,7 +63,7 @@ static int linear(int max, double bias);
|
||||
* second genes are selected from the pool
|
||||
*/
|
||||
void
|
||||
geqo_selection(Chromosome * momma, Chromosome * daddy, Pool * pool, double bias)
|
||||
geqo_selection(Chromosome *momma, Chromosome *daddy, Pool *pool, double bias)
|
||||
{
|
||||
int first,
|
||||
second;
|
||||
|
@ -7,7 +7,7 @@
|
||||
*
|
||||
*
|
||||
* IDENTIFICATION
|
||||
* $Header: /cvsroot/pgsql/src/backend/optimizer/geqo/Attic/minspantree.c,v 1.3 1997/09/08 02:24:09 momjian Exp $
|
||||
* $Header: /cvsroot/pgsql/src/backend/optimizer/geqo/Attic/minspantree.c,v 1.4 1997/09/08 21:44:42 momjian Exp $
|
||||
*
|
||||
*-------------------------------------------------------------------------
|
||||
*/
|
||||
@ -41,7 +41,7 @@
|
||||
*/
|
||||
|
||||
void
|
||||
minspantree(Query * root, List * join_rels, Rel * garel)
|
||||
minspantree(Query *root, List *join_rels, Rel *garel)
|
||||
{
|
||||
int number_of_rels = length(root->base_relation_list_);
|
||||
int number_of_joins = length(join_rels);
|
||||
@ -113,9 +113,9 @@ minspantree(Query * root, List * join_rels, Rel * garel)
|
||||
|
||||
else if (number_of_joins == 3)
|
||||
{
|
||||
Rel *rel12 = (Rel *) & tmprel_array[1][2];
|
||||
Rel *rel13 = (Rel *) & tmprel_array[1][3];
|
||||
Rel *rel23 = (Rel *) & tmprel_array[2][3];
|
||||
Rel *rel12 = (Rel *) &tmprel_array[1][2];
|
||||
Rel *rel13 = (Rel *) &tmprel_array[1][3];
|
||||
Rel *rel23 = (Rel *) &tmprel_array[2][3];
|
||||
|
||||
if (rel12->cheapestpath->path_cost > rel13->cheapestpath->path_cost)
|
||||
{
|
||||
@ -170,11 +170,11 @@ minspantree(Query * root, List * join_rels, Rel * garel)
|
||||
{
|
||||
if (n > tempn)
|
||||
{
|
||||
joinrel = (Rel *) & tmprel_array[tempn][n];
|
||||
joinrel = (Rel *) &tmprel_array[tempn][n];
|
||||
}
|
||||
else
|
||||
{
|
||||
joinrel = (Rel *) & tmprel_array[n][tempn];
|
||||
joinrel = (Rel *) &tmprel_array[n][tempn];
|
||||
}
|
||||
dist = joinrel->cheapestpath->path_cost;
|
||||
|
||||
|
@ -7,7 +7,7 @@
|
||||
*
|
||||
*
|
||||
* IDENTIFICATION
|
||||
* $Header: /cvsroot/pgsql/src/backend/optimizer/path/allpaths.c,v 1.12 1997/09/08 02:24:11 momjian Exp $
|
||||
* $Header: /cvsroot/pgsql/src/backend/optimizer/path/allpaths.c,v 1.13 1997/09/08 21:44:44 momjian Exp $
|
||||
*
|
||||
*-------------------------------------------------------------------------
|
||||
*/
|
||||
@ -43,8 +43,8 @@ bool _use_geqo_ = false;
|
||||
int32 _use_geqo_rels_ = GEQO_RELS;
|
||||
|
||||
|
||||
static void find_rel_paths(Query * root, List * rels);
|
||||
static List *find_join_paths(Query * root, List * outer_rels, int levels_left);
|
||||
static void find_rel_paths(Query *root, List *rels);
|
||||
static List *find_join_paths(Query *root, List *outer_rels, int levels_left);
|
||||
|
||||
/*
|
||||
* find-paths--
|
||||
@ -54,7 +54,7 @@ static List *find_join_paths(Query * root, List * outer_rels, int levels_left);
|
||||
* 'rels' is the list of single relation entries appearing in the query
|
||||
*/
|
||||
List *
|
||||
find_paths(Query * root, List * rels)
|
||||
find_paths(Query *root, List *rels)
|
||||
{
|
||||
int levels_left;
|
||||
|
||||
@ -102,7 +102,7 @@ find_paths(Query * root, List * rels)
|
||||
* MODIFIES: rels
|
||||
*/
|
||||
static void
|
||||
find_rel_paths(Query * root, List * rels)
|
||||
find_rel_paths(Query *root, List *rels)
|
||||
{
|
||||
List *temp;
|
||||
Rel *rel;
|
||||
@ -172,7 +172,7 @@ find_rel_paths(Query * root, List * rels)
|
||||
* the result of joining all the original relations togehter.
|
||||
*/
|
||||
static List *
|
||||
find_join_paths(Query * root, List * outer_rels, int levels_left)
|
||||
find_join_paths(Query *root, List *outer_rels, int levels_left)
|
||||
{
|
||||
List *x;
|
||||
List *new_rels;
|
||||
@ -281,10 +281,10 @@ find_join_paths(Query * root, List * outer_rels, int levels_left)
|
||||
|
||||
#ifdef OPTIMIZER_DEBUG
|
||||
static void
|
||||
print_joinclauses(Query * root, List * clauses)
|
||||
print_joinclauses(Query *root, List *clauses)
|
||||
{
|
||||
List *l;
|
||||
extern void print_expr(Node * expr, List * rtable); /* in print.c */
|
||||
extern void print_expr(Node *expr, List *rtable); /* in print.c */
|
||||
|
||||
foreach(l, clauses)
|
||||
{
|
||||
@ -297,7 +297,7 @@ print_joinclauses(Query * root, List * clauses)
|
||||
}
|
||||
|
||||
static void
|
||||
print_path(Query * root, Path * path, int indent)
|
||||
print_path(Query *root, Path *path, int indent)
|
||||
{
|
||||
char *ptype = NULL;
|
||||
JoinPath *jp;
|
||||
@ -404,7 +404,7 @@ print_path(Query * root, Path * path, int indent)
|
||||
}
|
||||
|
||||
static void
|
||||
debug_print_rel(Query * root, Rel * rel)
|
||||
debug_print_rel(Query *root, Rel *rel)
|
||||
{
|
||||
List *l;
|
||||
|
||||
|
@ -7,7 +7,7 @@
|
||||
*
|
||||
*
|
||||
* IDENTIFICATION
|
||||
* $Header: /cvsroot/pgsql/src/backend/optimizer/path/clausesel.c,v 1.3 1997/09/08 02:24:14 momjian Exp $
|
||||
* $Header: /cvsroot/pgsql/src/backend/optimizer/path/clausesel.c,v 1.4 1997/09/08 21:44:47 momjian Exp $
|
||||
*
|
||||
*-------------------------------------------------------------------------
|
||||
*/
|
||||
@ -31,7 +31,7 @@
|
||||
#include "utils/elog.h"
|
||||
#include "utils/lsyscache.h"
|
||||
|
||||
static Cost compute_selec(Query * root, List * clauses, List * or_selectivities);
|
||||
static Cost compute_selec(Query *root, List *clauses, List *or_selectivities);
|
||||
|
||||
/****************************************************************************
|
||||
* ROUTINES TO SET CLAUSE SELECTIVITIES
|
||||
@ -47,7 +47,7 @@ static Cost compute_selec(Query * root, List * clauses, List * or_selectivities)
|
||||
*
|
||||
*/
|
||||
void
|
||||
set_clause_selectivities(List * clauseinfo_list, Cost new_selectivity)
|
||||
set_clause_selectivities(List *clauseinfo_list, Cost new_selectivity)
|
||||
{
|
||||
List *temp;
|
||||
CInfo *clausenode;
|
||||
@ -71,7 +71,7 @@ set_clause_selectivities(List * clauseinfo_list, Cost new_selectivity)
|
||||
* Returns a flonum corresponding to the selectivity of 'clauseinfo-list'.
|
||||
*/
|
||||
Cost
|
||||
product_selec(List * clauseinfo_list)
|
||||
product_selec(List *clauseinfo_list)
|
||||
{
|
||||
Cost result = 1.0;
|
||||
|
||||
@ -99,7 +99,7 @@ product_selec(List * clauseinfo_list)
|
||||
* slots.
|
||||
*/
|
||||
void
|
||||
set_rest_relselec(Query * root, List * rel_list)
|
||||
set_rest_relselec(Query *root, List *rel_list)
|
||||
{
|
||||
Rel *rel;
|
||||
List *x;
|
||||
@ -120,7 +120,7 @@ set_rest_relselec(Query * root, List * rel_list)
|
||||
*
|
||||
*/
|
||||
void
|
||||
set_rest_selec(Query * root, List * clauseinfo_list)
|
||||
set_rest_selec(Query *root, List *clauseinfo_list)
|
||||
{
|
||||
List *temp = NIL;
|
||||
CInfo *clausenode = (CInfo *) NULL;
|
||||
@ -163,7 +163,7 @@ set_rest_selec(Query * root, List * clauseinfo_list)
|
||||
*
|
||||
*/
|
||||
Cost
|
||||
compute_clause_selec(Query * root, Node * clause, List * or_selectivities)
|
||||
compute_clause_selec(Query *root, Node *clause, List *or_selectivities)
|
||||
{
|
||||
if (!is_opclause(clause))
|
||||
{
|
||||
@ -223,7 +223,7 @@ compute_clause_selec(Query * root, Node * clause, List * or_selectivities)
|
||||
*
|
||||
*/
|
||||
static Cost
|
||||
compute_selec(Query * root, List * clauses, List * or_selectivities)
|
||||
compute_selec(Query *root, List *clauses, List *or_selectivities)
|
||||
{
|
||||
Cost s1 = 0;
|
||||
List *clause = lfirst(clauses);
|
||||
|
@ -7,7 +7,7 @@
|
||||
*
|
||||
*
|
||||
* IDENTIFICATION
|
||||
* $Header: /cvsroot/pgsql/src/backend/optimizer/path/costsize.c,v 1.18 1997/09/08 02:24:18 momjian Exp $
|
||||
* $Header: /cvsroot/pgsql/src/backend/optimizer/path/costsize.c,v 1.19 1997/09/08 21:44:50 momjian Exp $
|
||||
*
|
||||
*-------------------------------------------------------------------------
|
||||
*/
|
||||
@ -39,9 +39,9 @@
|
||||
|
||||
extern int NBuffers;
|
||||
|
||||
static int compute_attribute_width(TargetEntry * tlistentry);
|
||||
static int compute_attribute_width(TargetEntry *tlistentry);
|
||||
static double base_log(double x, double b);
|
||||
static int compute_targetlist_width(List * targetlist);
|
||||
static int compute_targetlist_width(List *targetlist);
|
||||
|
||||
int _disable_cost_ = 30000000;
|
||||
|
||||
@ -177,7 +177,7 @@ cost_index(Oid indexid,
|
||||
*
|
||||
*/
|
||||
Cost
|
||||
cost_sort(List * keys, int tuples, int width, bool noread)
|
||||
cost_sort(List *keys, int tuples, int width, bool noread)
|
||||
{
|
||||
Cost temp = 0;
|
||||
int npages = page_size(tuples, width);
|
||||
@ -278,8 +278,8 @@ cost_nestloop(Cost outercost,
|
||||
Cost
|
||||
cost_mergesort(Cost outercost,
|
||||
Cost innercost,
|
||||
List * outersortkeys,
|
||||
List * innersortkeys,
|
||||
List *outersortkeys,
|
||||
List *innersortkeys,
|
||||
int outersize,
|
||||
int innersize,
|
||||
int outerwidth,
|
||||
@ -316,8 +316,8 @@ cost_mergesort(Cost outercost,
|
||||
Cost
|
||||
cost_hashjoin(Cost outercost,
|
||||
Cost innercost,
|
||||
List * outerkeys,
|
||||
List * innerkeys,
|
||||
List *outerkeys,
|
||||
List *innerkeys,
|
||||
int outersize,
|
||||
int innersize,
|
||||
int outerwidth,
|
||||
@ -363,7 +363,7 @@ cost_hashjoin(Cost outercost,
|
||||
* Returns the size.
|
||||
*/
|
||||
int
|
||||
compute_rel_size(Rel * rel)
|
||||
compute_rel_size(Rel *rel)
|
||||
{
|
||||
Cost temp;
|
||||
int temp1;
|
||||
@ -390,7 +390,7 @@ compute_rel_size(Rel * rel)
|
||||
* Returns the width of the tuple as a fixnum.
|
||||
*/
|
||||
int
|
||||
compute_rel_width(Rel * rel)
|
||||
compute_rel_width(Rel *rel)
|
||||
{
|
||||
return (compute_targetlist_width(get_actual_tlist(rel->targetlist)));
|
||||
}
|
||||
@ -402,7 +402,7 @@ compute_rel_width(Rel * rel)
|
||||
* Returns the width of the tuple as a fixnum.
|
||||
*/
|
||||
static int
|
||||
compute_targetlist_width(List * targetlist)
|
||||
compute_targetlist_width(List *targetlist)
|
||||
{
|
||||
List *temp_tl;
|
||||
int tuple_width = 0;
|
||||
@ -425,7 +425,7 @@ compute_targetlist_width(List * targetlist)
|
||||
* Returns the width of the attribute as a fixnum.
|
||||
*/
|
||||
static int
|
||||
compute_attribute_width(TargetEntry * tlistentry)
|
||||
compute_attribute_width(TargetEntry *tlistentry)
|
||||
{
|
||||
int width = get_typlen(tlistentry->resdom->restype);
|
||||
|
||||
@ -442,7 +442,7 @@ compute_attribute_width(TargetEntry * tlistentry)
|
||||
* Returns a fixnum.
|
||||
*/
|
||||
int
|
||||
compute_joinrel_size(JoinPath * joinpath)
|
||||
compute_joinrel_size(JoinPath *joinpath)
|
||||
{
|
||||
Cost temp = 1.0;
|
||||
int temp1 = 0;
|
||||
|
@ -7,7 +7,7 @@
|
||||
*
|
||||
*
|
||||
* IDENTIFICATION
|
||||
* $Header: /cvsroot/pgsql/src/backend/optimizer/path/Attic/hashutils.c,v 1.3 1997/09/08 02:24:20 momjian Exp $
|
||||
* $Header: /cvsroot/pgsql/src/backend/optimizer/path/Attic/hashutils.c,v 1.4 1997/09/08 21:44:51 momjian Exp $
|
||||
*
|
||||
*-------------------------------------------------------------------------
|
||||
*/
|
||||
@ -20,7 +20,7 @@
|
||||
#include "optimizer/clauses.h"
|
||||
|
||||
|
||||
static HInfo *match_hashop_hashinfo(Oid hashop, List * hashinfo_list);
|
||||
static HInfo *match_hashop_hashinfo(Oid hashop, List *hashinfo_list);
|
||||
|
||||
/*
|
||||
* group-clauses-by-hashop--
|
||||
@ -35,7 +35,7 @@ static HInfo *match_hashop_hashinfo(Oid hashop, List * hashinfo_list);
|
||||
*
|
||||
*/
|
||||
List *
|
||||
group_clauses_by_hashop(List * clauseinfo_list,
|
||||
group_clauses_by_hashop(List *clauseinfo_list,
|
||||
int inner_relid)
|
||||
{
|
||||
List *hashinfo_list = NIL;
|
||||
@ -109,7 +109,7 @@ group_clauses_by_hashop(List * clauseinfo_list,
|
||||
*
|
||||
*/
|
||||
static HInfo *
|
||||
match_hashop_hashinfo(Oid hashop, List * hashinfo_list)
|
||||
match_hashop_hashinfo(Oid hashop, List *hashinfo_list)
|
||||
{
|
||||
Oid key = 0;
|
||||
HInfo *xhashinfo = (HInfo *) NULL;
|
||||
|
@ -8,7 +8,7 @@
|
||||
*
|
||||
*
|
||||
* IDENTIFICATION
|
||||
* $Header: /cvsroot/pgsql/src/backend/optimizer/path/indxpath.c,v 1.10 1997/09/08 02:24:21 momjian Exp $
|
||||
* $Header: /cvsroot/pgsql/src/backend/optimizer/path/indxpath.c,v 1.11 1997/09/08 21:44:55 momjian Exp $
|
||||
*
|
||||
*-------------------------------------------------------------------------
|
||||
*/
|
||||
@ -47,42 +47,42 @@
|
||||
|
||||
|
||||
static void
|
||||
match_index_orclauses(Rel * rel, Rel * index, int indexkey,
|
||||
int xclass, List * clauseinfo_list);
|
||||
match_index_orclauses(Rel *rel, Rel *index, int indexkey,
|
||||
int xclass, List *clauseinfo_list);
|
||||
static bool
|
||||
match_index_to_operand(int indexkey, Expr * operand,
|
||||
Rel * rel, Rel * index);
|
||||
match_index_to_operand(int indexkey, Expr *operand,
|
||||
Rel *rel, Rel *index);
|
||||
static List *
|
||||
match_index_orclause(Rel * rel, Rel * index, int indexkey,
|
||||
int xclass, List * or_clauses, List * other_matching_indices);
|
||||
match_index_orclause(Rel *rel, Rel *index, int indexkey,
|
||||
int xclass, List *or_clauses, List *other_matching_indices);
|
||||
static List *
|
||||
group_clauses_by_indexkey(Rel * rel, Rel * index,
|
||||
int *indexkeys, Oid * classes, List * clauseinfo_list);
|
||||
group_clauses_by_indexkey(Rel *rel, Rel *index,
|
||||
int *indexkeys, Oid *classes, List *clauseinfo_list);
|
||||
static List *
|
||||
group_clauses_by_ikey_for_joins(Rel * rel, Rel * index,
|
||||
int *indexkeys, Oid * classes, List * join_cinfo_list, List * restr_cinfo_list);
|
||||
group_clauses_by_ikey_for_joins(Rel *rel, Rel *index,
|
||||
int *indexkeys, Oid *classes, List *join_cinfo_list, List *restr_cinfo_list);
|
||||
static CInfo *
|
||||
match_clause_to_indexkey(Rel * rel, Rel * index, int indexkey,
|
||||
int xclass, CInfo * clauseInfo, bool join);
|
||||
match_clause_to_indexkey(Rel *rel, Rel *index, int indexkey,
|
||||
int xclass, CInfo *clauseInfo, bool join);
|
||||
static bool
|
||||
pred_test(List * predicate_list, List * clauseinfo_list,
|
||||
List * joininfo_list);
|
||||
static bool one_pred_test(Expr * predicate, List * clauseinfo_list);
|
||||
static bool one_pred_clause_expr_test(Expr * predicate, Node * clause);
|
||||
static bool one_pred_clause_test(Expr * predicate, Node * clause);
|
||||
static bool clause_pred_clause_test(Expr * predicate, Node * clause);
|
||||
pred_test(List *predicate_list, List *clauseinfo_list,
|
||||
List *joininfo_list);
|
||||
static bool one_pred_test(Expr *predicate, List *clauseinfo_list);
|
||||
static bool one_pred_clause_expr_test(Expr *predicate, Node *clause);
|
||||
static bool one_pred_clause_test(Expr *predicate, Node *clause);
|
||||
static bool clause_pred_clause_test(Expr *predicate, Node *clause);
|
||||
static List *
|
||||
indexable_joinclauses(Rel * rel, Rel * index,
|
||||
List * joininfo_list, List * clauseinfo_list);
|
||||
indexable_joinclauses(Rel *rel, Rel *index,
|
||||
List *joininfo_list, List *clauseinfo_list);
|
||||
static List *
|
||||
index_innerjoin(Query * root, Rel * rel,
|
||||
List * clausegroup_list, Rel * index);
|
||||
index_innerjoin(Query *root, Rel *rel,
|
||||
List *clausegroup_list, Rel *index);
|
||||
static List *
|
||||
create_index_paths(Query * root, Rel * rel, Rel * index,
|
||||
List * clausegroup_list, bool join);
|
||||
static List *add_index_paths(List * indexpaths, List * new_indexpaths);
|
||||
static bool function_index_operand(Expr * funcOpnd, Rel * rel, Rel * index);
|
||||
static bool SingleAttributeIndex(Rel * index);
|
||||
create_index_paths(Query *root, Rel *rel, Rel *index,
|
||||
List *clausegroup_list, bool join);
|
||||
static List *add_index_paths(List *indexpaths, List *new_indexpaths);
|
||||
static bool function_index_operand(Expr *funcOpnd, Rel *rel, Rel *index);
|
||||
static bool SingleAttributeIndex(Rel *index);
|
||||
|
||||
/* If Spyros can use a constant PRS2_BOOL_TYPEID, I can use this */
|
||||
#define BOOL_TYPEID ((Oid) 16)
|
||||
@ -114,11 +114,11 @@ static bool SingleAttributeIndex(Rel * index);
|
||||
*
|
||||
*/
|
||||
List *
|
||||
find_index_paths(Query * root,
|
||||
Rel * rel,
|
||||
List * indices,
|
||||
List * clauseinfo_list,
|
||||
List * joininfo_list)
|
||||
find_index_paths(Query *root,
|
||||
Rel *rel,
|
||||
List *indices,
|
||||
List *clauseinfo_list,
|
||||
List *joininfo_list)
|
||||
{
|
||||
List *scanclausegroups = NIL;
|
||||
List *scanpaths = NIL;
|
||||
@ -240,11 +240,11 @@ find_index_paths(Query * root,
|
||||
*
|
||||
*/
|
||||
static void
|
||||
match_index_orclauses(Rel * rel,
|
||||
Rel * index,
|
||||
match_index_orclauses(Rel *rel,
|
||||
Rel *index,
|
||||
int indexkey,
|
||||
int xclass,
|
||||
List * clauseinfo_list)
|
||||
List *clauseinfo_list)
|
||||
{
|
||||
CInfo *clauseinfo = (CInfo *) NULL;
|
||||
List *i = NIL;
|
||||
@ -277,9 +277,9 @@ match_index_orclauses(Rel * rel,
|
||||
*/
|
||||
static bool
|
||||
match_index_to_operand(int indexkey,
|
||||
Expr * operand,
|
||||
Rel * rel,
|
||||
Rel * index)
|
||||
Expr *operand,
|
||||
Rel *rel,
|
||||
Rel *index)
|
||||
{
|
||||
|
||||
/*
|
||||
@ -316,12 +316,12 @@ match_index_to_operand(int indexkey,
|
||||
* match the third, g,h match the fourth, etc.
|
||||
*/
|
||||
static List *
|
||||
match_index_orclause(Rel * rel,
|
||||
Rel * index,
|
||||
match_index_orclause(Rel *rel,
|
||||
Rel *index,
|
||||
int indexkey,
|
||||
int xclass,
|
||||
List * or_clauses,
|
||||
List * other_matching_indices)
|
||||
List *or_clauses,
|
||||
List *other_matching_indices)
|
||||
{
|
||||
Node *clause = NULL;
|
||||
List *matched_indices = other_matching_indices;
|
||||
@ -398,11 +398,11 @@ match_index_orclause(Rel * rel,
|
||||
*
|
||||
*/
|
||||
static List *
|
||||
group_clauses_by_indexkey(Rel * rel,
|
||||
Rel * index,
|
||||
group_clauses_by_indexkey(Rel *rel,
|
||||
Rel *index,
|
||||
int *indexkeys,
|
||||
Oid * classes,
|
||||
List * clauseinfo_list)
|
||||
Oid *classes,
|
||||
List *clauseinfo_list)
|
||||
{
|
||||
List *curCinfo = NIL;
|
||||
CInfo *matched_clause = (CInfo *) NULL;
|
||||
@ -460,12 +460,12 @@ group_clauses_by_indexkey(Rel * rel,
|
||||
*
|
||||
*/
|
||||
static List *
|
||||
group_clauses_by_ikey_for_joins(Rel * rel,
|
||||
Rel * index,
|
||||
group_clauses_by_ikey_for_joins(Rel *rel,
|
||||
Rel *index,
|
||||
int *indexkeys,
|
||||
Oid * classes,
|
||||
List * join_cinfo_list,
|
||||
List * restr_cinfo_list)
|
||||
Oid *classes,
|
||||
List *join_cinfo_list,
|
||||
List *restr_cinfo_list)
|
||||
{
|
||||
List *curCinfo = NIL;
|
||||
CInfo *matched_clause = (CInfo *) NULL;
|
||||
@ -583,11 +583,11 @@ group_clauses_by_ikey_for_joins(Rel * rel,
|
||||
*
|
||||
*/
|
||||
static CInfo *
|
||||
match_clause_to_indexkey(Rel * rel,
|
||||
Rel * index,
|
||||
match_clause_to_indexkey(Rel *rel,
|
||||
Rel *index,
|
||||
int indexkey,
|
||||
int xclass,
|
||||
CInfo * clauseInfo,
|
||||
CInfo *clauseInfo,
|
||||
bool join)
|
||||
{
|
||||
Expr *clause = clauseInfo->clause;
|
||||
@ -720,7 +720,7 @@ match_clause_to_indexkey(Rel * rel,
|
||||
* successfully cnfify()-ed). --Nels, Jan '93
|
||||
*/
|
||||
static bool
|
||||
pred_test(List * predicate_list, List * clauseinfo_list, List * joininfo_list)
|
||||
pred_test(List *predicate_list, List *clauseinfo_list, List *joininfo_list)
|
||||
{
|
||||
List *pred,
|
||||
*items,
|
||||
@ -771,7 +771,7 @@ pred_test(List * predicate_list, List * clauseinfo_list, List * joininfo_list)
|
||||
* expression.
|
||||
*/
|
||||
static bool
|
||||
one_pred_test(Expr * predicate, List * clauseinfo_list)
|
||||
one_pred_test(Expr *predicate, List *clauseinfo_list)
|
||||
{
|
||||
CInfo *clauseinfo;
|
||||
List *item;
|
||||
@ -794,7 +794,7 @@ one_pred_test(Expr * predicate, List * clauseinfo_list)
|
||||
* expression.
|
||||
*/
|
||||
static bool
|
||||
one_pred_clause_expr_test(Expr * predicate, Node * clause)
|
||||
one_pred_clause_expr_test(Expr *predicate, Node *clause)
|
||||
{
|
||||
List *items,
|
||||
*item;
|
||||
@ -841,7 +841,7 @@ one_pred_clause_expr_test(Expr * predicate, Node * clause)
|
||||
* expression for a simple restriction clause.
|
||||
*/
|
||||
static bool
|
||||
one_pred_clause_test(Expr * predicate, Node * clause)
|
||||
one_pred_clause_test(Expr *predicate, Node *clause)
|
||||
{
|
||||
List *items,
|
||||
*item;
|
||||
@ -923,7 +923,7 @@ StrategyNumber BT_implic_table[BTMaxStrategyNumber][BTMaxStrategyNumber] = {
|
||||
* appropriate "RT_implic_table" array.
|
||||
*/
|
||||
static bool
|
||||
clause_pred_clause_test(Expr * predicate, Node * clause)
|
||||
clause_pred_clause_test(Expr *predicate, Node *clause)
|
||||
{
|
||||
Var *pred_var,
|
||||
*clause_var;
|
||||
@ -1121,8 +1121,8 @@ clause_pred_clause_test(Expr * predicate, Node * clause)
|
||||
*
|
||||
*/
|
||||
static List *
|
||||
indexable_joinclauses(Rel * rel, Rel * index,
|
||||
List * joininfo_list, List * clauseinfo_list)
|
||||
indexable_joinclauses(Rel *rel, Rel *index,
|
||||
List *joininfo_list, List *clauseinfo_list)
|
||||
{
|
||||
JInfo *joininfo = (JInfo *) NULL;
|
||||
List *cg_list = NIL;
|
||||
@ -1166,7 +1166,7 @@ indexable_joinclauses(Rel * rel, Rel * index,
|
||||
*/
|
||||
#ifdef NOT_USED
|
||||
static List *
|
||||
extract_restrict_clauses(List * clausegroup)
|
||||
extract_restrict_clauses(List *clausegroup)
|
||||
{
|
||||
List *restrict_cls = NIL;
|
||||
List *l;
|
||||
@ -1197,7 +1197,7 @@ extract_restrict_clauses(List * clausegroup)
|
||||
*
|
||||
*/
|
||||
static List *
|
||||
index_innerjoin(Query * root, Rel * rel, List * clausegroup_list, Rel * index)
|
||||
index_innerjoin(Query *root, Rel *rel, List *clausegroup_list, Rel *index)
|
||||
{
|
||||
List *clausegroup = NIL;
|
||||
List *cg_list = NIL;
|
||||
@ -1282,10 +1282,10 @@ index_innerjoin(Query * root, Rel * rel, List * clausegroup_list, Rel * index)
|
||||
*
|
||||
*/
|
||||
static List *
|
||||
create_index_paths(Query * root,
|
||||
Rel * rel,
|
||||
Rel * index,
|
||||
List * clausegroup_list,
|
||||
create_index_paths(Query *root,
|
||||
Rel *rel,
|
||||
Rel *index,
|
||||
List *clausegroup_list,
|
||||
bool join)
|
||||
{
|
||||
List *clausegroup = NIL;
|
||||
@ -1325,13 +1325,13 @@ create_index_paths(Query * root,
|
||||
}
|
||||
|
||||
static List *
|
||||
add_index_paths(List * indexpaths, List * new_indexpaths)
|
||||
add_index_paths(List *indexpaths, List *new_indexpaths)
|
||||
{
|
||||
return append(indexpaths, new_indexpaths);
|
||||
}
|
||||
|
||||
static bool
|
||||
function_index_operand(Expr * funcOpnd, Rel * rel, Rel * index)
|
||||
function_index_operand(Expr *funcOpnd, Rel *rel, Rel *index)
|
||||
{
|
||||
Oid heapRelid = (Oid) lfirsti(rel->relids);
|
||||
Func *function;
|
||||
@ -1391,7 +1391,7 @@ function_index_operand(Expr * funcOpnd, Rel * rel, Rel * index)
|
||||
}
|
||||
|
||||
static bool
|
||||
SingleAttributeIndex(Rel * index)
|
||||
SingleAttributeIndex(Rel *index)
|
||||
{
|
||||
|
||||
/*
|
||||
|
@ -7,7 +7,7 @@
|
||||
*
|
||||
*
|
||||
* IDENTIFICATION
|
||||
* $Header: /cvsroot/pgsql/src/backend/optimizer/path/joinpath.c,v 1.4 1997/09/08 02:24:22 momjian Exp $
|
||||
* $Header: /cvsroot/pgsql/src/backend/optimizer/path/joinpath.c,v 1.5 1997/09/08 21:44:59 momjian Exp $
|
||||
*
|
||||
*-------------------------------------------------------------------------
|
||||
*/
|
||||
@ -29,21 +29,21 @@
|
||||
#include "optimizer/cost.h" /* for _enable_{hashjoin,
|
||||
* _enable_mergesort} */
|
||||
|
||||
static Path *best_innerjoin(List * join_paths, List * outer_relid);
|
||||
static Path *best_innerjoin(List *join_paths, List *outer_relid);
|
||||
static List *
|
||||
sort_inner_and_outer(Rel * joinrel, Rel * outerrel, Rel * innerrel,
|
||||
List * mergeinfo_list);
|
||||
sort_inner_and_outer(Rel *joinrel, Rel *outerrel, Rel *innerrel,
|
||||
List *mergeinfo_list);
|
||||
static List *
|
||||
match_unsorted_outer(Rel * joinrel, Rel * outerrel, Rel * innerrel,
|
||||
List * outerpath_list, Path * cheapest_inner, Path * best_innerjoin,
|
||||
List * mergeinfo_list);
|
||||
match_unsorted_outer(Rel *joinrel, Rel *outerrel, Rel *innerrel,
|
||||
List *outerpath_list, Path *cheapest_inner, Path *best_innerjoin,
|
||||
List *mergeinfo_list);
|
||||
static List *
|
||||
match_unsorted_inner(Rel * joinrel, Rel * outerrel, Rel * innerrel,
|
||||
List * innerpath_list, List * mergeinfo_list);
|
||||
static bool EnoughMemoryForHashjoin(Rel * hashrel);
|
||||
match_unsorted_inner(Rel *joinrel, Rel *outerrel, Rel *innerrel,
|
||||
List *innerpath_list, List *mergeinfo_list);
|
||||
static bool EnoughMemoryForHashjoin(Rel *hashrel);
|
||||
static List *
|
||||
hash_inner_and_outer(Rel * joinrel, Rel * outerrel, Rel * innerrel,
|
||||
List * hashinfo_list);
|
||||
hash_inner_and_outer(Rel *joinrel, Rel *outerrel, Rel *innerrel,
|
||||
List *hashinfo_list);
|
||||
|
||||
/*
|
||||
* find-all-join-paths--
|
||||
@ -67,7 +67,7 @@ hash_inner_and_outer(Rel * joinrel, Rel * outerrel, Rel * innerrel,
|
||||
* It does a destructive modification.
|
||||
*/
|
||||
void
|
||||
find_all_join_paths(Query * root, List * joinrels)
|
||||
find_all_join_paths(Query *root, List *joinrels)
|
||||
{
|
||||
List *mergeinfo_list = NIL;
|
||||
List *hashinfo_list = NIL;
|
||||
@ -206,7 +206,7 @@ find_all_join_paths(Query * root, List * joinrels)
|
||||
* Returns the pathnode of the selected path.
|
||||
*/
|
||||
static Path *
|
||||
best_innerjoin(List * join_paths, List * outer_relids)
|
||||
best_innerjoin(List *join_paths, List *outer_relids)
|
||||
{
|
||||
Path *cheapest = (Path *) NULL;
|
||||
List *join_path;
|
||||
@ -240,10 +240,10 @@ best_innerjoin(List * join_paths, List * outer_relids)
|
||||
* Returns a list of mergesort paths.
|
||||
*/
|
||||
static List *
|
||||
sort_inner_and_outer(Rel * joinrel,
|
||||
Rel * outerrel,
|
||||
Rel * innerrel,
|
||||
List * mergeinfo_list)
|
||||
sort_inner_and_outer(Rel *joinrel,
|
||||
Rel *outerrel,
|
||||
Rel *innerrel,
|
||||
List *mergeinfo_list)
|
||||
{
|
||||
List *ms_list = NIL;
|
||||
MInfo *xmergeinfo = (MInfo *) NULL;
|
||||
@ -318,13 +318,13 @@ sort_inner_and_outer(Rel * joinrel,
|
||||
* Returns a list of possible join path nodes.
|
||||
*/
|
||||
static List *
|
||||
match_unsorted_outer(Rel * joinrel,
|
||||
Rel * outerrel,
|
||||
Rel * innerrel,
|
||||
List * outerpath_list,
|
||||
Path * cheapest_inner,
|
||||
Path * best_innerjoin,
|
||||
List * mergeinfo_list)
|
||||
match_unsorted_outer(Rel *joinrel,
|
||||
Rel *outerrel,
|
||||
Rel *innerrel,
|
||||
List *outerpath_list,
|
||||
Path *cheapest_inner,
|
||||
Path *best_innerjoin,
|
||||
List *mergeinfo_list)
|
||||
{
|
||||
Path *outerpath = (Path *) NULL;
|
||||
List *jp_list = NIL;
|
||||
@ -485,11 +485,11 @@ match_unsorted_outer(Rel * joinrel,
|
||||
* Returns a list of possible merge paths.
|
||||
*/
|
||||
static List *
|
||||
match_unsorted_inner(Rel * joinrel,
|
||||
Rel * outerrel,
|
||||
Rel * innerrel,
|
||||
List * innerpath_list,
|
||||
List * mergeinfo_list)
|
||||
match_unsorted_inner(Rel *joinrel,
|
||||
Rel *outerrel,
|
||||
Rel *innerrel,
|
||||
List *innerpath_list,
|
||||
List *mergeinfo_list)
|
||||
{
|
||||
Path *innerpath = (Path *) NULL;
|
||||
List *mp_list = NIL;
|
||||
@ -583,7 +583,7 @@ match_unsorted_inner(Rel * joinrel,
|
||||
}
|
||||
|
||||
static bool
|
||||
EnoughMemoryForHashjoin(Rel * hashrel)
|
||||
EnoughMemoryForHashjoin(Rel *hashrel)
|
||||
{
|
||||
int ntuples;
|
||||
int tupsize;
|
||||
@ -617,10 +617,10 @@ EnoughMemoryForHashjoin(Rel * hashrel)
|
||||
* Returns a list of hashjoin paths.
|
||||
*/
|
||||
static List *
|
||||
hash_inner_and_outer(Rel * joinrel,
|
||||
Rel * outerrel,
|
||||
Rel * innerrel,
|
||||
List * hashinfo_list)
|
||||
hash_inner_and_outer(Rel *joinrel,
|
||||
Rel *outerrel,
|
||||
Rel *innerrel,
|
||||
List *hashinfo_list)
|
||||
{
|
||||
HInfo *xhashinfo = (HInfo *) NULL;
|
||||
List *hjoin_list = NIL;
|
||||
|
@ -7,7 +7,7 @@
|
||||
*
|
||||
*
|
||||
* IDENTIFICATION
|
||||
* $Header: /cvsroot/pgsql/src/backend/optimizer/path/joinrels.c,v 1.6 1997/09/08 02:24:23 momjian Exp $
|
||||
* $Header: /cvsroot/pgsql/src/backend/optimizer/path/joinrels.c,v 1.7 1997/09/08 21:45:00 momjian Exp $
|
||||
*
|
||||
*-------------------------------------------------------------------------
|
||||
*/
|
||||
@ -31,19 +31,19 @@ bool _use_right_sided_plans_ = false;
|
||||
|
||||
#endif
|
||||
|
||||
static List *find_clause_joins(Query * root, Rel * outer_rel, List * joininfo_list);
|
||||
static List *find_clauseless_joins(Rel * outer_rel, List * inner_rels);
|
||||
static Rel *init_join_rel(Rel * outer_rel, Rel * inner_rel, JInfo * joininfo);
|
||||
static List *find_clause_joins(Query *root, Rel *outer_rel, List *joininfo_list);
|
||||
static List *find_clauseless_joins(Rel *outer_rel, List *inner_rels);
|
||||
static Rel *init_join_rel(Rel *outer_rel, Rel *inner_rel, JInfo *joininfo);
|
||||
static List *
|
||||
new_join_tlist(List * tlist, List * other_relids,
|
||||
new_join_tlist(List *tlist, List *other_relids,
|
||||
int first_resdomno);
|
||||
static List *new_joininfo_list(List * joininfo_list, List * join_relids);
|
||||
static void add_superrels(Rel * rel, Rel * super_rel);
|
||||
static bool nonoverlap_rels(Rel * rel1, Rel * rel2);
|
||||
static bool nonoverlap_sets(List * s1, List * s2);
|
||||
static List *new_joininfo_list(List *joininfo_list, List *join_relids);
|
||||
static void add_superrels(Rel *rel, Rel *super_rel);
|
||||
static bool nonoverlap_rels(Rel *rel1, Rel *rel2);
|
||||
static bool nonoverlap_sets(List *s1, List *s2);
|
||||
static void
|
||||
set_joinrel_size(Rel * joinrel, Rel * outer_rel, Rel * inner_rel,
|
||||
JInfo * jinfo);
|
||||
set_joinrel_size(Rel *joinrel, Rel *outer_rel, Rel *inner_rel,
|
||||
JInfo *jinfo);
|
||||
|
||||
/*
|
||||
* find-join-rels--
|
||||
@ -59,7 +59,7 @@ set_joinrel_size(Rel * joinrel, Rel * outer_rel, Rel * inner_rel,
|
||||
* Returns a list of rel nodes corresponding to the new join relations.
|
||||
*/
|
||||
List *
|
||||
find_join_rels(Query * root, List * outer_rels)
|
||||
find_join_rels(Query *root, List *outer_rels)
|
||||
{
|
||||
List *joins = NIL;
|
||||
List *join_list = NIL;
|
||||
@ -97,7 +97,7 @@ find_join_rels(Query * root, List * outer_rels)
|
||||
* Returns a list of new join relations.
|
||||
*/
|
||||
static List *
|
||||
find_clause_joins(Query * root, Rel * outer_rel, List * joininfo_list)
|
||||
find_clause_joins(Query *root, Rel *outer_rel, List *joininfo_list)
|
||||
{
|
||||
List *join_list = NIL;
|
||||
List *i = NIL;
|
||||
@ -158,7 +158,7 @@ find_clause_joins(Query * root, Rel * outer_rel, List * joininfo_list)
|
||||
* Returns a list of new join relations.
|
||||
*/
|
||||
static List *
|
||||
find_clauseless_joins(Rel * outer_rel, List * inner_rels)
|
||||
find_clauseless_joins(Rel *outer_rel, List *inner_rels)
|
||||
{
|
||||
Rel *inner_rel;
|
||||
List *t_list = NIL;
|
||||
@ -193,7 +193,7 @@ find_clauseless_joins(Rel * outer_rel, List * inner_rels)
|
||||
* Returns the new join relation node.
|
||||
*/
|
||||
static Rel *
|
||||
init_join_rel(Rel * outer_rel, Rel * inner_rel, JInfo * joininfo)
|
||||
init_join_rel(Rel *outer_rel, Rel *inner_rel, JInfo *joininfo)
|
||||
{
|
||||
Rel *joinrel = makeNode(Rel);
|
||||
List *joinrel_joininfo_list = NIL;
|
||||
@ -273,8 +273,8 @@ init_join_rel(Rel * outer_rel, Rel * inner_rel, JInfo * joininfo)
|
||||
* Returns the new target list.
|
||||
*/
|
||||
static List *
|
||||
new_join_tlist(List * tlist,
|
||||
List * other_relids,
|
||||
new_join_tlist(List *tlist,
|
||||
List *other_relids,
|
||||
int first_resdomno)
|
||||
{
|
||||
int resdomno = first_resdomno - 1;
|
||||
@ -323,7 +323,7 @@ new_join_tlist(List * tlist,
|
||||
* Returns a list of joininfo nodes, new and old.
|
||||
*/
|
||||
static List *
|
||||
new_joininfo_list(List * joininfo_list, List * join_relids)
|
||||
new_joininfo_list(List *joininfo_list, List *join_relids)
|
||||
{
|
||||
List *current_joininfo_list = NIL;
|
||||
List *new_otherrels = NIL;
|
||||
@ -387,7 +387,7 @@ new_joininfo_list(List * joininfo_list, List * join_relids)
|
||||
* Modifies the joininfo field of appropriate rel nodes.
|
||||
*/
|
||||
void
|
||||
add_new_joininfos(Query * root, List * joinrels, List * outerrels)
|
||||
add_new_joininfos(Query *root, List *joinrels, List *outerrels)
|
||||
{
|
||||
List *xjoinrel = NIL;
|
||||
List *xrelid = NIL;
|
||||
@ -487,7 +487,7 @@ add_new_joininfos(Query * root, List * joinrels, List * outerrels)
|
||||
* Returns the list of final join relations.
|
||||
*/
|
||||
List *
|
||||
final_join_rels(List * join_rel_list)
|
||||
final_join_rels(List *join_rel_list)
|
||||
{
|
||||
List *xrel = NIL;
|
||||
List *temp = NIL;
|
||||
@ -533,7 +533,7 @@ final_join_rels(List * join_rel_list)
|
||||
* Modifies the superrels field of rel
|
||||
*/
|
||||
static void
|
||||
add_superrels(Rel * rel, Rel * super_rel)
|
||||
add_superrels(Rel *rel, Rel *super_rel)
|
||||
{
|
||||
rel->superrels = lappend(rel->superrels, super_rel);
|
||||
}
|
||||
@ -548,13 +548,13 @@ add_superrels(Rel * rel, Rel * super_rel)
|
||||
* Returns non-nil if rel1 and rel2 do not overlap.
|
||||
*/
|
||||
static bool
|
||||
nonoverlap_rels(Rel * rel1, Rel * rel2)
|
||||
nonoverlap_rels(Rel *rel1, Rel *rel2)
|
||||
{
|
||||
return (nonoverlap_sets(rel1->relids, rel2->relids));
|
||||
}
|
||||
|
||||
static bool
|
||||
nonoverlap_sets(List * s1, List * s2)
|
||||
nonoverlap_sets(List *s1, List *s2)
|
||||
{
|
||||
List *x = NIL;
|
||||
|
||||
@ -569,7 +569,7 @@ nonoverlap_sets(List * s1, List * s2)
|
||||
}
|
||||
|
||||
static void
|
||||
set_joinrel_size(Rel * joinrel, Rel * outer_rel, Rel * inner_rel, JInfo * jinfo)
|
||||
set_joinrel_size(Rel *joinrel, Rel *outer_rel, Rel *inner_rel, JInfo *jinfo)
|
||||
{
|
||||
int ntuples;
|
||||
float selec;
|
||||
|
@ -7,7 +7,7 @@
|
||||
*
|
||||
*
|
||||
* IDENTIFICATION
|
||||
* $Header: /cvsroot/pgsql/src/backend/optimizer/path/Attic/joinutils.c,v 1.3 1997/09/08 02:24:23 momjian Exp $
|
||||
* $Header: /cvsroot/pgsql/src/backend/optimizer/path/Attic/joinutils.c,v 1.4 1997/09/08 21:45:01 momjian Exp $
|
||||
*
|
||||
*-------------------------------------------------------------------------
|
||||
*/
|
||||
@ -27,18 +27,18 @@
|
||||
|
||||
|
||||
static int
|
||||
match_pathkey_joinkeys(List * pathkey, List * joinkeys,
|
||||
match_pathkey_joinkeys(List *pathkey, List *joinkeys,
|
||||
int which_subkey);
|
||||
static bool
|
||||
every_func(List * joinkeys, List * pathkey,
|
||||
every_func(List *joinkeys, List *pathkey,
|
||||
int which_subkey);
|
||||
static List *
|
||||
new_join_pathkey(List * subkeys,
|
||||
List * considered_subkeys, List * join_rel_tlist,
|
||||
List * joinclauses);
|
||||
new_join_pathkey(List *subkeys,
|
||||
List *considered_subkeys, List *join_rel_tlist,
|
||||
List *joinclauses);
|
||||
static List *
|
||||
new_matching_subkeys(Var * subkey, List * considered_subkeys,
|
||||
List * join_rel_tlist, List * joinclauses);
|
||||
new_matching_subkeys(Var *subkey, List *considered_subkeys,
|
||||
List *join_rel_tlist, List *joinclauses);
|
||||
|
||||
/****************************************************************************
|
||||
* KEY COMPARISONS
|
||||
@ -74,11 +74,11 @@ new_matching_subkeys(Var * subkey, List * considered_subkeys,
|
||||
* in matchedJoinClausesPtr. - ay 11/94
|
||||
*/
|
||||
List *
|
||||
match_pathkeys_joinkeys(List * pathkeys,
|
||||
List * joinkeys,
|
||||
List * joinclauses,
|
||||
match_pathkeys_joinkeys(List *pathkeys,
|
||||
List *joinkeys,
|
||||
List *joinclauses,
|
||||
int which_subkey,
|
||||
List ** matchedJoinClausesPtr)
|
||||
List **matchedJoinClausesPtr)
|
||||
{
|
||||
List *matched_joinkeys = NIL;
|
||||
List *matched_joinclauses = NIL;
|
||||
@ -127,8 +127,8 @@ match_pathkeys_joinkeys(List * pathkeys,
|
||||
* outer or inner subkey matches any subkey of 'pathkey'.
|
||||
*/
|
||||
static int
|
||||
match_pathkey_joinkeys(List * pathkey,
|
||||
List * joinkeys,
|
||||
match_pathkey_joinkeys(List *pathkey,
|
||||
List *joinkeys,
|
||||
int which_subkey)
|
||||
{
|
||||
Var *path_subkey;
|
||||
@ -175,7 +175,7 @@ match_pathkey_joinkeys(List * pathkey,
|
||||
* Returns the matching path node if one exists, nil otherwise.
|
||||
*/
|
||||
static bool
|
||||
every_func(List * joinkeys, List * pathkey, int which_subkey)
|
||||
every_func(List *joinkeys, List *pathkey, int which_subkey)
|
||||
{
|
||||
JoinKey *xjoinkey;
|
||||
Var *temp;
|
||||
@ -212,9 +212,9 @@ every_func(List * joinkeys, List * pathkey, int which_subkey)
|
||||
* find the cheapest path that matches the join keys
|
||||
*/
|
||||
Path *
|
||||
match_paths_joinkeys(List * joinkeys,
|
||||
PathOrder * ordering,
|
||||
List * paths,
|
||||
match_paths_joinkeys(List *joinkeys,
|
||||
PathOrder *ordering,
|
||||
List *paths,
|
||||
int which_subkey)
|
||||
{
|
||||
Path *matched_path = NULL;
|
||||
@ -264,8 +264,8 @@ match_paths_joinkeys(List * joinkeys,
|
||||
* [I've no idea why they have to be list of lists. Should be fixed. -ay 12/94]
|
||||
*/
|
||||
List *
|
||||
extract_path_keys(List * joinkeys,
|
||||
List * tlist,
|
||||
extract_path_keys(List *joinkeys,
|
||||
List *tlist,
|
||||
int which_subkey)
|
||||
{
|
||||
List *pathkeys = NIL;
|
||||
@ -326,9 +326,9 @@ extract_path_keys(List * joinkeys,
|
||||
*
|
||||
*/
|
||||
List *
|
||||
new_join_pathkeys(List * outer_pathkeys,
|
||||
List * join_rel_tlist,
|
||||
List * joinclauses)
|
||||
new_join_pathkeys(List *outer_pathkeys,
|
||||
List *join_rel_tlist,
|
||||
List *joinclauses)
|
||||
{
|
||||
List *outer_pathkey = NIL;
|
||||
List *t_list = NIL;
|
||||
@ -366,10 +366,10 @@ new_join_pathkeys(List * outer_pathkeys,
|
||||
*
|
||||
*/
|
||||
static List *
|
||||
new_join_pathkey(List * subkeys,
|
||||
List * considered_subkeys,
|
||||
List * join_rel_tlist,
|
||||
List * joinclauses)
|
||||
new_join_pathkey(List *subkeys,
|
||||
List *considered_subkeys,
|
||||
List *join_rel_tlist,
|
||||
List *joinclauses)
|
||||
{
|
||||
List *t_list = NIL;
|
||||
Var *subkey;
|
||||
@ -426,10 +426,10 @@ new_join_pathkey(List * subkeys,
|
||||
*
|
||||
*/
|
||||
static List *
|
||||
new_matching_subkeys(Var * subkey,
|
||||
List * considered_subkeys,
|
||||
List * join_rel_tlist,
|
||||
List * joinclauses)
|
||||
new_matching_subkeys(Var *subkey,
|
||||
List *considered_subkeys,
|
||||
List *join_rel_tlist,
|
||||
List *joinclauses)
|
||||
{
|
||||
Expr *joinclause = NULL;
|
||||
List *t_list = NIL;
|
||||
|
@ -7,7 +7,7 @@
|
||||
*
|
||||
*
|
||||
* IDENTIFICATION
|
||||
* $Header: /cvsroot/pgsql/src/backend/optimizer/path/Attic/mergeutils.c,v 1.3 1997/09/08 02:24:24 momjian Exp $
|
||||
* $Header: /cvsroot/pgsql/src/backend/optimizer/path/Attic/mergeutils.c,v 1.4 1997/09/08 21:45:02 momjian Exp $
|
||||
*
|
||||
*-------------------------------------------------------------------------
|
||||
*/
|
||||
@ -34,7 +34,7 @@
|
||||
*
|
||||
*/
|
||||
List *
|
||||
group_clauses_by_order(List * clauseinfo_list,
|
||||
group_clauses_by_order(List *clauseinfo_list,
|
||||
int inner_relid)
|
||||
{
|
||||
List *mergeinfo_list = NIL;
|
||||
@ -106,7 +106,7 @@ group_clauses_by_order(List * clauseinfo_list,
|
||||
*
|
||||
*/
|
||||
MInfo *
|
||||
match_order_mergeinfo(PathOrder * ordering, List * mergeinfo_list)
|
||||
match_order_mergeinfo(PathOrder *ordering, List *mergeinfo_list)
|
||||
{
|
||||
MergeOrder *xmergeorder;
|
||||
List *xmergeinfo = NIL;
|
||||
|
@ -7,7 +7,7 @@
|
||||
*
|
||||
*
|
||||
* IDENTIFICATION
|
||||
* $Header: /cvsroot/pgsql/src/backend/optimizer/path/orindxpath.c,v 1.3 1997/09/08 02:24:25 momjian Exp $
|
||||
* $Header: /cvsroot/pgsql/src/backend/optimizer/path/orindxpath.c,v 1.4 1997/09/08 21:45:04 momjian Exp $
|
||||
*
|
||||
*-------------------------------------------------------------------------
|
||||
*/
|
||||
@ -32,12 +32,12 @@
|
||||
|
||||
|
||||
static void
|
||||
best_or_subclause_indices(Query * root, Rel * rel, List * subclauses,
|
||||
List * indices, List * examined_indexids, Cost subcost, List * selectivities,
|
||||
List ** indexids, Cost * cost, List ** selecs);
|
||||
best_or_subclause_indices(Query *root, Rel *rel, List *subclauses,
|
||||
List *indices, List *examined_indexids, Cost subcost, List *selectivities,
|
||||
List **indexids, Cost *cost, List **selecs);
|
||||
static void
|
||||
best_or_subclause_index(Query * root, Rel * rel, Expr * subclause,
|
||||
List * indices, int *indexid, Cost * cost, Cost * selec);
|
||||
best_or_subclause_index(Query *root, Rel *rel, Expr *subclause,
|
||||
List *indices, int *indexid, Cost *cost, Cost *selec);
|
||||
|
||||
|
||||
/*
|
||||
@ -51,8 +51,8 @@ best_or_subclause_index(Query * root, Rel * rel, Expr * subclause,
|
||||
*
|
||||
*/
|
||||
List *
|
||||
create_or_index_paths(Query * root,
|
||||
Rel * rel, List * clauses)
|
||||
create_or_index_paths(Query *root,
|
||||
Rel *rel, List *clauses)
|
||||
{
|
||||
List *t_list = NIL;
|
||||
|
||||
@ -158,16 +158,16 @@ create_or_index_paths(Query * root,
|
||||
* 'cost' is a flonum, and 's' is a flonum.
|
||||
*/
|
||||
static void
|
||||
best_or_subclause_indices(Query * root,
|
||||
Rel * rel,
|
||||
List * subclauses,
|
||||
List * indices,
|
||||
List * examined_indexids,
|
||||
best_or_subclause_indices(Query *root,
|
||||
Rel *rel,
|
||||
List *subclauses,
|
||||
List *indices,
|
||||
List *examined_indexids,
|
||||
Cost subcost,
|
||||
List * selectivities,
|
||||
List ** indexids, /* return value */
|
||||
Cost * cost, /* return value */
|
||||
List ** selecs) /* return value */
|
||||
List *selectivities,
|
||||
List **indexids, /* return value */
|
||||
Cost *cost, /* return value */
|
||||
List **selecs) /* return value */
|
||||
{
|
||||
if (subclauses == NIL)
|
||||
{
|
||||
@ -213,13 +213,13 @@ best_or_subclause_indices(Query * root,
|
||||
*
|
||||
*/
|
||||
static void
|
||||
best_or_subclause_index(Query * root,
|
||||
Rel * rel,
|
||||
Expr * subclause,
|
||||
List * indices,
|
||||
best_or_subclause_index(Query *root,
|
||||
Rel *rel,
|
||||
Expr *subclause,
|
||||
List *indices,
|
||||
int *retIndexid, /* return value */
|
||||
Cost * retCost, /* return value */
|
||||
Cost * retSelec) /* return value */
|
||||
Cost *retCost, /* return value */
|
||||
Cost *retSelec) /* return value */
|
||||
{
|
||||
if (indices != NIL)
|
||||
{
|
||||
|
@ -7,7 +7,7 @@
|
||||
*
|
||||
*
|
||||
* IDENTIFICATION
|
||||
* $Header: /cvsroot/pgsql/src/backend/optimizer/path/Attic/predmig.c,v 1.5 1997/09/08 20:56:03 momjian Exp $
|
||||
* $Header: /cvsroot/pgsql/src/backend/optimizer/path/Attic/predmig.c,v 1.6 1997/09/08 21:45:07 momjian Exp $
|
||||
*
|
||||
*-------------------------------------------------------------------------
|
||||
*/
|
||||
@ -56,7 +56,7 @@
|
||||
|
||||
static void
|
||||
xfunc_predmig(JoinPath pathnode, Stream streamroot,
|
||||
Stream laststream, bool * progressp);
|
||||
Stream laststream, bool *progressp);
|
||||
static bool xfunc_series_llel(Stream stream);
|
||||
static bool xfunc_llel_chains(Stream root, Stream bottom);
|
||||
static Stream xfunc_complete_stream(Stream stream);
|
||||
@ -78,7 +78,7 @@ static int xfunc_stream_compare(void *arg1, void *arg2);
|
||||
static bool xfunc_check_stream(Stream node);
|
||||
static bool xfunc_in_stream(Stream node, Stream stream);
|
||||
|
||||
/* ----------------- MAIN FUNCTIONS ------------------------ */
|
||||
/* ----------------- MAIN FUNCTIONS ------------------------ */
|
||||
/*
|
||||
** xfunc_do_predmig
|
||||
** wrapper for Predicate Migration. It calls xfunc_predmig until no
|
||||
@ -120,7 +120,7 @@ xfunc_predmig(JoinPath pathnode,/* root of the join tree */
|
||||
Stream laststream,/* for recursive calls -- these are the
|
||||
* root of the stream under construction,
|
||||
* and the lowest node created so far */
|
||||
bool * progressp)
|
||||
bool *progressp)
|
||||
{
|
||||
Stream newstream;
|
||||
|
||||
@ -410,7 +410,7 @@ xfunc_prdmig_pullup(Stream origstream, Stream pullme, JoinPath joinpath)
|
||||
** the same groupcost and groupsel (since they're in the same group!)
|
||||
*/
|
||||
static void
|
||||
xfunc_form_groups(Query * queryInfo, Stream root, Stream bottom)
|
||||
xfunc_form_groups(Query *queryInfo, Stream root, Stream bottom)
|
||||
{
|
||||
Stream temp,
|
||||
parent;
|
||||
@ -495,7 +495,7 @@ xfunc_form_groups(Query * queryInfo, Stream root, Stream bottom)
|
||||
}
|
||||
|
||||
|
||||
/* ------------------- UTILITY FUNCTIONS ------------------------- */
|
||||
/* ------------------- UTILITY FUNCTIONS ------------------------- */
|
||||
|
||||
/*
|
||||
** xfunc_free_stream --
|
||||
@ -765,7 +765,7 @@ xfunc_stream_compare(void *arg1, void *arg2)
|
||||
}
|
||||
}
|
||||
|
||||
/* ------------------ DEBUGGING ROUTINES ---------------------------- */
|
||||
/* ------------------ DEBUGGING ROUTINES ---------------------------- */
|
||||
|
||||
/*
|
||||
** Make sure all pointers in stream make sense. Make sure no joins are
|
||||
|
@ -7,7 +7,7 @@
|
||||
*
|
||||
*
|
||||
* IDENTIFICATION
|
||||
* $Header: /cvsroot/pgsql/src/backend/optimizer/path/Attic/prune.c,v 1.5 1997/09/08 02:24:27 momjian Exp $
|
||||
* $Header: /cvsroot/pgsql/src/backend/optimizer/path/Attic/prune.c,v 1.6 1997/09/08 21:45:08 momjian Exp $
|
||||
*
|
||||
*-------------------------------------------------------------------------
|
||||
*/
|
||||
@ -24,7 +24,7 @@
|
||||
#include "utils/elog.h"
|
||||
|
||||
|
||||
static List *prune_joinrel(Rel * rel, List * other_rels);
|
||||
static List *prune_joinrel(Rel *rel, List *other_rels);
|
||||
|
||||
/*
|
||||
* prune-joinrels--
|
||||
@ -35,7 +35,7 @@ static List *prune_joinrel(Rel * rel, List * other_rels);
|
||||
*
|
||||
*/
|
||||
List *
|
||||
prune_joinrels(List * rel_list)
|
||||
prune_joinrels(List *rel_list)
|
||||
{
|
||||
List *temp_list = NIL;
|
||||
|
||||
@ -60,7 +60,7 @@ prune_joinrels(List * rel_list)
|
||||
*
|
||||
*/
|
||||
static List *
|
||||
prune_joinrel(Rel * rel, List * other_rels)
|
||||
prune_joinrel(Rel *rel, List *other_rels)
|
||||
{
|
||||
List *i = NIL;
|
||||
List *t_list = NIL;
|
||||
@ -97,7 +97,7 @@ prune_joinrel(Rel * rel, List * other_rels)
|
||||
*
|
||||
*/
|
||||
void
|
||||
prune_rel_paths(List * rel_list)
|
||||
prune_rel_paths(List *rel_list)
|
||||
{
|
||||
List *x = NIL;
|
||||
List *y = NIL;
|
||||
@ -140,7 +140,7 @@ prune_rel_paths(List * rel_list)
|
||||
*
|
||||
*/
|
||||
Path *
|
||||
prune_rel_path(Rel * rel, Path * unorderedpath)
|
||||
prune_rel_path(Rel *rel, Path *unorderedpath)
|
||||
{
|
||||
Path *cheapest = set_cheapest(rel, rel->pathlist);
|
||||
|
||||
@ -171,7 +171,7 @@ prune_rel_path(Rel * rel, Path * unorderedpath)
|
||||
* Returns one pruned rel node list
|
||||
*/
|
||||
List *
|
||||
merge_joinrels(List * rel_list1, List * rel_list2)
|
||||
merge_joinrels(List *rel_list1, List *rel_list2)
|
||||
{
|
||||
List *xrel = NIL;
|
||||
|
||||
@ -197,7 +197,7 @@ merge_joinrels(List * rel_list1, List * rel_list2)
|
||||
* Returns a new list of rel nodes
|
||||
*/
|
||||
List *
|
||||
prune_oldrels(List * old_rels)
|
||||
prune_oldrels(List *old_rels)
|
||||
{
|
||||
Rel *rel;
|
||||
List *joininfo_list,
|
||||
|
@ -9,7 +9,7 @@
|
||||
*
|
||||
*
|
||||
* IDENTIFICATION
|
||||
* $Header: /cvsroot/pgsql/src/backend/optimizer/path/Attic/xfunc.c,v 1.5 1997/09/08 02:24:28 momjian Exp $
|
||||
* $Header: /cvsroot/pgsql/src/backend/optimizer/path/Attic/xfunc.c,v 1.6 1997/09/08 21:45:10 momjian Exp $
|
||||
*
|
||||
*-------------------------------------------------------------------------
|
||||
*/
|
||||
@ -47,8 +47,8 @@
|
||||
|
||||
/* local funcs */
|
||||
static int
|
||||
xfunc_card_unreferenced(Query * queryInfo,
|
||||
Expr * clause, Relid referenced);
|
||||
xfunc_card_unreferenced(Query *queryInfo,
|
||||
Expr *clause, Relid referenced);
|
||||
|
||||
*/
|
||||
|
||||
@ -146,11 +146,11 @@ xfunc_trypullup(Rel rel)
|
||||
** XFUNC_JOINPRD if a secondary join predicate is to be pulled up
|
||||
*/
|
||||
int
|
||||
xfunc_shouldpull(Query * queryInfo,
|
||||
xfunc_shouldpull(Query *queryInfo,
|
||||
Path childpath,
|
||||
JoinPath parentpath,
|
||||
int whichchild,
|
||||
CInfo * maxcinfopt) /* Out: pointer to clause to
|
||||
CInfo *maxcinfopt) /* Out: pointer to clause to
|
||||
* pullup */
|
||||
{
|
||||
LispValue clauselist,
|
||||
@ -231,8 +231,8 @@ xfunc_shouldpull(Query * queryInfo,
|
||||
|| (!is_join(childpath)
|
||||
&& (whichchild == INNER)
|
||||
&& IsA(parentpath, JoinPath)
|
||||
&& !IsA(parentpath, HashPath)
|
||||
&& !IsA(parentpath, MergePath)))))
|
||||
&&!IsA(parentpath, HashPath)
|
||||
&&!IsA(parentpath, MergePath)))))
|
||||
{
|
||||
|
||||
*maxcinfopt = maxcinfo;
|
||||
@ -267,7 +267,7 @@ xfunc_shouldpull(Query * queryInfo,
|
||||
** Now returns a pointer to the new pulled-up CInfo. -- JMH, 11/18/92
|
||||
*/
|
||||
CInfo
|
||||
xfunc_pullup(Query * queryInfo,
|
||||
xfunc_pullup(Query *queryInfo,
|
||||
Path childpath,
|
||||
JoinPath parentpath,
|
||||
CInfo cinfo, /* clause to pull up */
|
||||
@ -360,7 +360,7 @@ xfunc_pullup(Query * queryInfo,
|
||||
** calculate (selectivity-1)/cost.
|
||||
*/
|
||||
Cost
|
||||
xfunc_rank(Query * queryInfo, LispValue clause)
|
||||
xfunc_rank(Query *queryInfo, LispValue clause)
|
||||
{
|
||||
Cost selec = compute_clause_selec(queryInfo, clause, LispNil);
|
||||
Cost cost = xfunc_expense(queryInfo, clause);
|
||||
@ -379,7 +379,7 @@ xfunc_rank(Query * queryInfo, LispValue clause)
|
||||
** referenced in the clause.
|
||||
*/
|
||||
Cost
|
||||
xfunc_expense(Query * queryInfo, clause)
|
||||
xfunc_expense(Query *queryInfo, clause)
|
||||
LispValue clause;
|
||||
{
|
||||
Cost cost = xfunc_local_expense(clause);
|
||||
@ -400,7 +400,7 @@ LispValue clause;
|
||||
** Find global expense of a join clause
|
||||
*/
|
||||
Cost
|
||||
xfunc_join_expense(Query * queryInfo, JoinPath path, int whichchild)
|
||||
xfunc_join_expense(Query *queryInfo, JoinPath path, int whichchild)
|
||||
{
|
||||
LispValue primjoinclause = xfunc_primary_join(path);
|
||||
|
||||
@ -435,7 +435,7 @@ xfunc_local_expense(LispValue clause)
|
||||
LispValue tmpclause;
|
||||
|
||||
/* First handle the base case */
|
||||
if (IsA(clause, Const) || IsA(clause, Var) || IsA(clause, Param))
|
||||
if (IsA(clause, Const) ||IsA(clause, Var) ||IsA(clause, Param))
|
||||
return (0);
|
||||
/* now other stuff */
|
||||
else if (IsA(clause, Iter))
|
||||
@ -519,7 +519,7 @@ xfunc_func_expense(LispValue node, LispValue args)
|
||||
LispValue tmpplan;
|
||||
List planlist;
|
||||
|
||||
if (IsA(node, Oper) || get_func_planlist((Func) node) == LispNil)
|
||||
if (IsA(node, Oper) ||get_func_planlist((Func) node) == LispNil)
|
||||
{
|
||||
Oid *argOidVect; /* vector of argtypes */
|
||||
char *pq_src; /* text of PQ function */
|
||||
@ -735,7 +735,7 @@ exit:
|
||||
** for joins).
|
||||
*/
|
||||
static Count
|
||||
xfunc_card_unreferenced(Query * queryInfo,
|
||||
xfunc_card_unreferenced(Query *queryInfo,
|
||||
LispValue clause, Relid referenced)
|
||||
{
|
||||
Relid unreferenced,
|
||||
@ -763,7 +763,7 @@ xfunc_card_unreferenced(Query * queryInfo,
|
||||
** multiple together cardinalities of a list relations.
|
||||
*/
|
||||
Count
|
||||
xfunc_card_product(Query * queryInfo, Relid relids)
|
||||
xfunc_card_product(Query *queryInfo, Relid relids)
|
||||
{
|
||||
LispValue cinfonode;
|
||||
LispValue temp;
|
||||
@ -813,7 +813,7 @@ xfunc_find_references(LispValue clause)
|
||||
/* Base cases */
|
||||
if (IsA(clause, Var))
|
||||
return (lispCons(lfirst(get_varid((Var) clause)), LispNil));
|
||||
else if (IsA(clause, Const) || IsA(clause, Param))
|
||||
else if (IsA(clause, Const) ||IsA(clause, Param))
|
||||
return ((List) LispNil);
|
||||
|
||||
/* recursion */
|
||||
@ -929,7 +929,7 @@ xfunc_primary_join(JoinPath pathnode)
|
||||
** get the expensive function costs of the path
|
||||
*/
|
||||
Cost
|
||||
xfunc_get_path_cost(Query * queryInfo, Path pathnode)
|
||||
xfunc_get_path_cost(Query *queryInfo, Path pathnode)
|
||||
{
|
||||
Cost cost = 0;
|
||||
LispValue tmplist;
|
||||
@ -1048,7 +1048,7 @@ xfunc_total_path_cost(JoinPath pathnode)
|
||||
}
|
||||
else if (IsA(pathnode, HashPath))
|
||||
{
|
||||
HashPath hashnode = (HashPath) pathnode;
|
||||
HashPath hashnode = (HashPath) pathnode;
|
||||
|
||||
cost += cost_hashjoin(get_path_cost((Path) get_outerjoinpath(hashnode)),
|
||||
get_path_cost((Path) get_innerjoinpath(hashnode)),
|
||||
@ -1153,7 +1153,7 @@ xfunc_fixvars(LispValue clause, /* clause being pulled up */
|
||||
TargetEntry *tle; /* tlist member corresponding to var */
|
||||
|
||||
|
||||
if (IsA(clause, Const) || IsA(clause, Param))
|
||||
if (IsA(clause, Const) ||IsA(clause, Param))
|
||||
return;
|
||||
else if (IsA(clause, Var))
|
||||
{
|
||||
@ -1261,7 +1261,7 @@ xfunc_disjunct_sort(LispValue clause_list)
|
||||
** arg1 and arg2 are really pointers to disjuncts
|
||||
*/
|
||||
int
|
||||
xfunc_disjunct_compare(Query * queryInfo, void *arg1, void *arg2)
|
||||
xfunc_disjunct_compare(Query *queryInfo, void *arg1, void *arg2)
|
||||
{
|
||||
LispValue disjunct1 = *(LispValue *) arg1;
|
||||
LispValue disjunct2 = *(LispValue *) arg2;
|
||||
@ -1436,11 +1436,11 @@ xfunc_LispRemove(LispValue foo, List bar)
|
||||
** Just like _copyRel, but doesn't copy the paths
|
||||
*/
|
||||
bool
|
||||
xfunc_copyrel(Rel from, Rel * to)
|
||||
xfunc_copyrel(Rel from, Rel *to)
|
||||
{
|
||||
Rel newnode;
|
||||
|
||||
Pointer(*alloc) () = palloc;
|
||||
Pointer (*alloc) () = palloc;
|
||||
|
||||
/* COPY_CHECKARGS() */
|
||||
if (to == NULL)
|
||||
|
@ -7,7 +7,7 @@
|
||||
*
|
||||
*
|
||||
* IDENTIFICATION
|
||||
* $Header: /cvsroot/pgsql/src/backend/optimizer/plan/createplan.c,v 1.14 1997/09/08 20:56:10 momjian Exp $
|
||||
* $Header: /cvsroot/pgsql/src/backend/optimizer/plan/createplan.c,v 1.15 1997/09/08 21:45:13 momjian Exp $
|
||||
*
|
||||
*-------------------------------------------------------------------------
|
||||
*/
|
||||
@ -44,47 +44,47 @@
|
||||
#define TEMP_SORT 1
|
||||
#define TEMP_MATERIAL 2
|
||||
|
||||
static List *switch_outer(List * clauses);
|
||||
static Scan *create_scan_node(Path * best_path, List * tlist);
|
||||
static Join *create_join_node(JoinPath * best_path, List * tlist);
|
||||
static List *switch_outer(List *clauses);
|
||||
static Scan *create_scan_node(Path *best_path, List *tlist);
|
||||
static Join *create_join_node(JoinPath *best_path, List *tlist);
|
||||
static SeqScan *
|
||||
create_seqscan_node(Path * best_path, List * tlist,
|
||||
List * scan_clauses);
|
||||
create_seqscan_node(Path *best_path, List *tlist,
|
||||
List *scan_clauses);
|
||||
static IndexScan *
|
||||
create_indexscan_node(IndexPath * best_path, List * tlist,
|
||||
List * scan_clauses);
|
||||
create_indexscan_node(IndexPath *best_path, List *tlist,
|
||||
List *scan_clauses);
|
||||
static NestLoop *
|
||||
create_nestloop_node(JoinPath * best_path, List * tlist,
|
||||
List * clauses, Plan * outer_node, List * outer_tlist,
|
||||
Plan * inner_node, List * inner_tlist);
|
||||
create_nestloop_node(JoinPath *best_path, List *tlist,
|
||||
List *clauses, Plan *outer_node, List *outer_tlist,
|
||||
Plan *inner_node, List *inner_tlist);
|
||||
static MergeJoin *
|
||||
create_mergejoin_node(MergePath * best_path, List * tlist,
|
||||
List * clauses, Plan * outer_node, List * outer_tlist,
|
||||
Plan * inner_node, List * inner_tlist);
|
||||
create_mergejoin_node(MergePath *best_path, List *tlist,
|
||||
List *clauses, Plan *outer_node, List *outer_tlist,
|
||||
Plan *inner_node, List *inner_tlist);
|
||||
static HashJoin *
|
||||
create_hashjoin_node(HashPath * best_path, List * tlist,
|
||||
List * clauses, Plan * outer_node, List * outer_tlist,
|
||||
Plan * inner_node, List * inner_tlist);
|
||||
static Node *fix_indxqual_references(Node * clause, Path * index_path);
|
||||
create_hashjoin_node(HashPath *best_path, List *tlist,
|
||||
List *clauses, Plan *outer_node, List *outer_tlist,
|
||||
Plan *inner_node, List *inner_tlist);
|
||||
static Node *fix_indxqual_references(Node *clause, Path *index_path);
|
||||
static Temp *
|
||||
make_temp(List * tlist, List * keys, Oid * operators,
|
||||
Plan * plan_node, int temptype);
|
||||
make_temp(List *tlist, List *keys, Oid *operators,
|
||||
Plan *plan_node, int temptype);
|
||||
static IndexScan *
|
||||
make_indexscan(List * qptlist, List * qpqual, Index scanrelid,
|
||||
List * indxid, List * indxqual);
|
||||
make_indexscan(List *qptlist, List *qpqual, Index scanrelid,
|
||||
List *indxid, List *indxqual);
|
||||
static NestLoop *
|
||||
make_nestloop(List * qptlist, List * qpqual, Plan * lefttree,
|
||||
Plan * righttree);
|
||||
make_nestloop(List *qptlist, List *qpqual, Plan *lefttree,
|
||||
Plan *righttree);
|
||||
static HashJoin *
|
||||
make_hashjoin(List * tlist, List * qpqual,
|
||||
List * hashclauses, Plan * lefttree, Plan * righttree);
|
||||
static Hash *make_hash(List * tlist, Var * hashkey, Plan * lefttree);
|
||||
make_hashjoin(List *tlist, List *qpqual,
|
||||
List *hashclauses, Plan *lefttree, Plan *righttree);
|
||||
static Hash *make_hash(List *tlist, Var *hashkey, Plan *lefttree);
|
||||
static MergeJoin *
|
||||
make_mergesort(List * tlist, List * qpqual,
|
||||
List * mergeclauses, Oid opcode, Oid * rightorder,
|
||||
Oid * leftorder, Plan * righttree, Plan * lefttree);
|
||||
make_mergesort(List *tlist, List *qpqual,
|
||||
List *mergeclauses, Oid opcode, Oid *rightorder,
|
||||
Oid *leftorder, Plan *righttree, Plan *lefttree);
|
||||
static Material *
|
||||
make_material(List * tlist, Oid tempid, Plan * lefttree,
|
||||
make_material(List *tlist, Oid tempid, Plan *lefttree,
|
||||
int keycount);
|
||||
|
||||
/*
|
||||
@ -103,7 +103,7 @@ make_material(List * tlist, Oid tempid, Plan * lefttree,
|
||||
* Returns the optimal(?) access plan.
|
||||
*/
|
||||
Plan *
|
||||
create_plan(Path * best_path)
|
||||
create_plan(Path *best_path)
|
||||
{
|
||||
List *tlist;
|
||||
Plan *plan_node = (Plan *) NULL;
|
||||
@ -167,7 +167,7 @@ create_plan(Path * best_path)
|
||||
* Returns the scan node.
|
||||
*/
|
||||
static Scan *
|
||||
create_scan_node(Path * best_path, List * tlist)
|
||||
create_scan_node(Path *best_path, List *tlist)
|
||||
{
|
||||
|
||||
Scan *node = NULL;
|
||||
@ -216,7 +216,7 @@ create_scan_node(Path * best_path, List * tlist)
|
||||
* Returns the join node.
|
||||
*/
|
||||
static Join *
|
||||
create_join_node(JoinPath * best_path, List * tlist)
|
||||
create_join_node(JoinPath *best_path, List *tlist)
|
||||
{
|
||||
Plan *outer_node;
|
||||
List *outer_tlist;
|
||||
@ -298,7 +298,7 @@ create_join_node(JoinPath * best_path, List * tlist)
|
||||
* with restriction clauses 'scan-clauses' and targetlist 'tlist'.
|
||||
*/
|
||||
static SeqScan *
|
||||
create_seqscan_node(Path * best_path, List * tlist, List * scan_clauses)
|
||||
create_seqscan_node(Path *best_path, List *tlist, List *scan_clauses)
|
||||
{
|
||||
SeqScan *scan_node = (SeqScan *) NULL;
|
||||
Index scan_relid = -1;
|
||||
@ -326,9 +326,9 @@ create_seqscan_node(Path * best_path, List * tlist, List * scan_clauses)
|
||||
* with restriction clauses 'scan-clauses' and targetlist 'tlist'.
|
||||
*/
|
||||
static IndexScan *
|
||||
create_indexscan_node(IndexPath * best_path,
|
||||
List * tlist,
|
||||
List * scan_clauses)
|
||||
create_indexscan_node(IndexPath *best_path,
|
||||
List *tlist,
|
||||
List *scan_clauses)
|
||||
{
|
||||
|
||||
/*
|
||||
@ -430,13 +430,13 @@ create_indexscan_node(IndexPath * best_path,
|
||||
*****************************************************************************/
|
||||
|
||||
static NestLoop *
|
||||
create_nestloop_node(JoinPath * best_path,
|
||||
List * tlist,
|
||||
List * clauses,
|
||||
Plan * outer_node,
|
||||
List * outer_tlist,
|
||||
Plan * inner_node,
|
||||
List * inner_tlist)
|
||||
create_nestloop_node(JoinPath *best_path,
|
||||
List *tlist,
|
||||
List *clauses,
|
||||
Plan *outer_node,
|
||||
List *outer_tlist,
|
||||
Plan *inner_node,
|
||||
List *inner_tlist)
|
||||
{
|
||||
NestLoop *join_node = (NestLoop *) NULL;
|
||||
|
||||
@ -512,13 +512,13 @@ create_nestloop_node(JoinPath * best_path,
|
||||
}
|
||||
|
||||
static MergeJoin *
|
||||
create_mergejoin_node(MergePath * best_path,
|
||||
List * tlist,
|
||||
List * clauses,
|
||||
Plan * outer_node,
|
||||
List * outer_tlist,
|
||||
Plan * inner_node,
|
||||
List * inner_tlist)
|
||||
create_mergejoin_node(MergePath *best_path,
|
||||
List *tlist,
|
||||
List *clauses,
|
||||
Plan *outer_node,
|
||||
List *outer_tlist,
|
||||
Plan *inner_node,
|
||||
List *inner_tlist)
|
||||
{
|
||||
List *qpqual,
|
||||
*mergeclauses;
|
||||
@ -609,13 +609,13 @@ create_mergejoin_node(MergePath * best_path,
|
||||
* these?? at runtime? what about a hash index?
|
||||
*/
|
||||
static HashJoin *
|
||||
create_hashjoin_node(HashPath * best_path,
|
||||
List * tlist,
|
||||
List * clauses,
|
||||
Plan * outer_node,
|
||||
List * outer_tlist,
|
||||
Plan * inner_node,
|
||||
List * inner_tlist)
|
||||
create_hashjoin_node(HashPath *best_path,
|
||||
List *tlist,
|
||||
List *clauses,
|
||||
Plan *outer_node,
|
||||
List *outer_tlist,
|
||||
Plan *inner_node,
|
||||
List *inner_tlist)
|
||||
{
|
||||
List *qpqual;
|
||||
List *hashclauses;
|
||||
@ -663,7 +663,7 @@ create_hashjoin_node(HashPath * best_path,
|
||||
*****************************************************************************/
|
||||
|
||||
static Node *
|
||||
fix_indxqual_references(Node * clause, Path * index_path)
|
||||
fix_indxqual_references(Node *clause, Path *index_path)
|
||||
{
|
||||
Node *newclause;
|
||||
|
||||
@ -800,7 +800,7 @@ fix_indxqual_references(Node * clause, Path * index_path)
|
||||
* XXX Shouldn't the operator be commuted?!
|
||||
*/
|
||||
static List *
|
||||
switch_outer(List * clauses)
|
||||
switch_outer(List *clauses)
|
||||
{
|
||||
List *t_list = NIL;
|
||||
Expr *temp = NULL;
|
||||
@ -844,7 +844,7 @@ switch_outer(List * clauses)
|
||||
* Returns the modified target list.
|
||||
*/
|
||||
static List *
|
||||
set_temp_tlist_operators(List * tlist, List * pathkeys, Oid * operators)
|
||||
set_temp_tlist_operators(List *tlist, List *pathkeys, Oid *operators)
|
||||
{
|
||||
Node *keys = NULL;
|
||||
int keyno = 1;
|
||||
@ -892,10 +892,10 @@ set_temp_tlist_operators(List * tlist, List * pathkeys, Oid * operators)
|
||||
* 'temptype' indicates which operation(sort or hash) to perform
|
||||
*/
|
||||
static Temp *
|
||||
make_temp(List * tlist,
|
||||
List * keys,
|
||||
Oid * operators,
|
||||
Plan * plan_node,
|
||||
make_temp(List *tlist,
|
||||
List *keys,
|
||||
Oid *operators,
|
||||
Plan *plan_node,
|
||||
int temptype)
|
||||
{
|
||||
List *temp_tlist;
|
||||
@ -936,10 +936,10 @@ make_temp(List * tlist,
|
||||
|
||||
|
||||
SeqScan *
|
||||
make_seqscan(List * qptlist,
|
||||
List * qpqual,
|
||||
make_seqscan(List *qptlist,
|
||||
List *qpqual,
|
||||
Index scanrelid,
|
||||
Plan * lefttree)
|
||||
Plan *lefttree)
|
||||
{
|
||||
SeqScan *node = makeNode(SeqScan);
|
||||
Plan *plan = &node->plan;
|
||||
@ -957,11 +957,11 @@ make_seqscan(List * qptlist,
|
||||
}
|
||||
|
||||
static IndexScan *
|
||||
make_indexscan(List * qptlist,
|
||||
List * qpqual,
|
||||
make_indexscan(List *qptlist,
|
||||
List *qpqual,
|
||||
Index scanrelid,
|
||||
List * indxid,
|
||||
List * indxqual)
|
||||
List *indxid,
|
||||
List *indxqual)
|
||||
{
|
||||
IndexScan *node = makeNode(IndexScan);
|
||||
Plan *plan = &node->scan.plan;
|
||||
@ -982,10 +982,10 @@ make_indexscan(List * qptlist,
|
||||
|
||||
|
||||
static NestLoop *
|
||||
make_nestloop(List * qptlist,
|
||||
List * qpqual,
|
||||
Plan * lefttree,
|
||||
Plan * righttree)
|
||||
make_nestloop(List *qptlist,
|
||||
List *qpqual,
|
||||
Plan *lefttree,
|
||||
Plan *righttree)
|
||||
{
|
||||
NestLoop *node = makeNode(NestLoop);
|
||||
Plan *plan = &node->join;
|
||||
@ -1002,11 +1002,11 @@ make_nestloop(List * qptlist,
|
||||
}
|
||||
|
||||
static HashJoin *
|
||||
make_hashjoin(List * tlist,
|
||||
List * qpqual,
|
||||
List * hashclauses,
|
||||
Plan * lefttree,
|
||||
Plan * righttree)
|
||||
make_hashjoin(List *tlist,
|
||||
List *qpqual,
|
||||
List *hashclauses,
|
||||
Plan *lefttree,
|
||||
Plan *righttree)
|
||||
{
|
||||
HashJoin *node = makeNode(HashJoin);
|
||||
Plan *plan = &node->join;
|
||||
@ -1027,7 +1027,7 @@ make_hashjoin(List * tlist,
|
||||
}
|
||||
|
||||
static Hash *
|
||||
make_hash(List * tlist, Var * hashkey, Plan * lefttree)
|
||||
make_hash(List *tlist, Var *hashkey, Plan *lefttree)
|
||||
{
|
||||
Hash *node = makeNode(Hash);
|
||||
Plan *plan = &node->plan;
|
||||
@ -1047,14 +1047,14 @@ make_hash(List * tlist, Var * hashkey, Plan * lefttree)
|
||||
}
|
||||
|
||||
static MergeJoin *
|
||||
make_mergesort(List * tlist,
|
||||
List * qpqual,
|
||||
List * mergeclauses,
|
||||
make_mergesort(List *tlist,
|
||||
List *qpqual,
|
||||
List *mergeclauses,
|
||||
Oid opcode,
|
||||
Oid * rightorder,
|
||||
Oid * leftorder,
|
||||
Plan * righttree,
|
||||
Plan * lefttree)
|
||||
Oid *rightorder,
|
||||
Oid *leftorder,
|
||||
Plan *righttree,
|
||||
Plan *lefttree)
|
||||
{
|
||||
MergeJoin *node = makeNode(MergeJoin);
|
||||
Plan *plan = &node->join;
|
||||
@ -1074,7 +1074,7 @@ make_mergesort(List * tlist,
|
||||
}
|
||||
|
||||
Sort *
|
||||
make_sort(List * tlist, Oid tempid, Plan * lefttree, int keycount)
|
||||
make_sort(List *tlist, Oid tempid, Plan *lefttree, int keycount)
|
||||
{
|
||||
Sort *node = makeNode(Sort);
|
||||
Plan *plan = &node->plan;
|
||||
@ -1092,9 +1092,9 @@ make_sort(List * tlist, Oid tempid, Plan * lefttree, int keycount)
|
||||
}
|
||||
|
||||
static Material *
|
||||
make_material(List * tlist,
|
||||
make_material(List *tlist,
|
||||
Oid tempid,
|
||||
Plan * lefttree,
|
||||
Plan *lefttree,
|
||||
int keycount)
|
||||
{
|
||||
Material *node = makeNode(Material);
|
||||
@ -1113,7 +1113,7 @@ make_material(List * tlist,
|
||||
}
|
||||
|
||||
Agg *
|
||||
make_agg(List * tlist, int nagg, Aggreg **aggs)
|
||||
make_agg(List *tlist, int nagg, Aggreg **aggs)
|
||||
{
|
||||
Agg *node = makeNode(Agg);
|
||||
|
||||
@ -1130,11 +1130,11 @@ make_agg(List * tlist, int nagg, Aggreg **aggs)
|
||||
}
|
||||
|
||||
Group *
|
||||
make_group(List * tlist,
|
||||
make_group(List *tlist,
|
||||
bool tuplePerGroup,
|
||||
int ngrp,
|
||||
AttrNumber *grpColIdx,
|
||||
Sort * lefttree)
|
||||
Sort *lefttree)
|
||||
{
|
||||
Group *node = makeNode(Group);
|
||||
|
||||
@ -1160,7 +1160,7 @@ make_group(List * tlist,
|
||||
*/
|
||||
|
||||
Unique *
|
||||
make_unique(List * tlist, Plan * lefttree, char *uniqueAttr)
|
||||
make_unique(List *tlist, Plan *lefttree, char *uniqueAttr)
|
||||
{
|
||||
Unique *node = makeNode(Unique);
|
||||
Plan *plan = &node->plan;
|
||||
@ -1183,7 +1183,7 @@ make_unique(List * tlist, Plan * lefttree, char *uniqueAttr)
|
||||
}
|
||||
|
||||
List *
|
||||
generate_fjoin(List * tlist)
|
||||
generate_fjoin(List *tlist)
|
||||
{
|
||||
#if 0
|
||||
List tlistP;
|
||||
|
@ -7,7 +7,7 @@
|
||||
*
|
||||
*
|
||||
* IDENTIFICATION
|
||||
* $Header: /cvsroot/pgsql/src/backend/optimizer/plan/initsplan.c,v 1.7 1997/09/08 02:24:36 momjian Exp $
|
||||
* $Header: /cvsroot/pgsql/src/backend/optimizer/plan/initsplan.c,v 1.8 1997/09/08 21:45:19 momjian Exp $
|
||||
*
|
||||
*-------------------------------------------------------------------------
|
||||
*/
|
||||
@ -35,14 +35,14 @@
|
||||
|
||||
extern int Quiet;
|
||||
|
||||
static void add_clause_to_rels(Query * root, List * clause);
|
||||
static void add_clause_to_rels(Query *root, List *clause);
|
||||
static void
|
||||
add_join_clause_info_to_rels(Query * root, CInfo * clauseinfo,
|
||||
List * join_relids);
|
||||
static void add_vars_to_rels(Query * root, List * vars, List * join_relids);
|
||||
add_join_clause_info_to_rels(Query *root, CInfo *clauseinfo,
|
||||
List *join_relids);
|
||||
static void add_vars_to_rels(Query *root, List *vars, List *join_relids);
|
||||
|
||||
static MergeOrder *mergesortop(Expr * clause);
|
||||
static Oid hashjoinop(Expr * clause);
|
||||
static MergeOrder *mergesortop(Expr *clause);
|
||||
static Oid hashjoinop(Expr *clause);
|
||||
|
||||
|
||||
/*****************************************************************************
|
||||
@ -61,7 +61,7 @@ static Oid hashjoinop(Expr * clause);
|
||||
* Returns nothing.
|
||||
*/
|
||||
void
|
||||
initialize_base_rels_list(Query * root, List * tlist)
|
||||
initialize_base_rels_list(Query *root, List *tlist)
|
||||
{
|
||||
List *tlist_vars = NIL;
|
||||
List *l = NIL;
|
||||
@ -98,7 +98,7 @@ initialize_base_rels_list(Query * root, List * tlist)
|
||||
* into a join.
|
||||
*/
|
||||
void
|
||||
add_missing_vars_to_base_rels(Query * root, List * tlist)
|
||||
add_missing_vars_to_base_rels(Query *root, List *tlist)
|
||||
{
|
||||
List *l;
|
||||
int varno;
|
||||
@ -145,7 +145,7 @@ add_missing_vars_to_base_rels(Query * root, List * tlist)
|
||||
* Returns nothing of interest.
|
||||
*/
|
||||
void
|
||||
initialize_base_rels_jinfo(Query * root, List * clauses)
|
||||
initialize_base_rels_jinfo(Query *root, List *clauses)
|
||||
{
|
||||
List *clause;
|
||||
|
||||
@ -166,7 +166,7 @@ initialize_base_rels_jinfo(Query * root, List * clauses)
|
||||
* Returns nothing of interest.
|
||||
*/
|
||||
static void
|
||||
add_clause_to_rels(Query * root, List * clause)
|
||||
add_clause_to_rels(Query *root, List *clause)
|
||||
{
|
||||
List *relids;
|
||||
List *vars;
|
||||
@ -259,7 +259,7 @@ add_clause_to_rels(Query * root, List * clause)
|
||||
*
|
||||
*/
|
||||
static void
|
||||
add_join_clause_info_to_rels(Query * root, CInfo * clauseinfo, List * join_relids)
|
||||
add_join_clause_info_to_rels(Query *root, CInfo *clauseinfo, List *join_relids)
|
||||
{
|
||||
List *join_relid;
|
||||
|
||||
@ -300,7 +300,7 @@ add_join_clause_info_to_rels(Query * root, CInfo * clauseinfo, List * join_relid
|
||||
* Returns nothing.
|
||||
*/
|
||||
static void
|
||||
add_vars_to_rels(Query * root, List * vars, List * join_relids)
|
||||
add_vars_to_rels(Query *root, List *vars, List *join_relids)
|
||||
{
|
||||
Var *var;
|
||||
List *temp = NIL;
|
||||
@ -334,7 +334,7 @@ add_vars_to_rels(Query * root, List * vars, List * join_relids)
|
||||
* Returns nothing.
|
||||
*/
|
||||
void
|
||||
initialize_join_clause_info(List * rel_list)
|
||||
initialize_join_clause_info(List *rel_list)
|
||||
{
|
||||
List *x,
|
||||
*y,
|
||||
@ -387,7 +387,7 @@ initialize_join_clause_info(List * rel_list)
|
||||
* a mergesortable operator.
|
||||
*/
|
||||
static MergeOrder *
|
||||
mergesortop(Expr * clause)
|
||||
mergesortop(Expr *clause)
|
||||
{
|
||||
Oid leftOp,
|
||||
rightOp;
|
||||
@ -421,7 +421,7 @@ mergesortop(Expr * clause)
|
||||
* a hashjoinable operator.
|
||||
*/
|
||||
static Oid
|
||||
hashjoinop(Expr * clause)
|
||||
hashjoinop(Expr *clause)
|
||||
{
|
||||
return (op_hashjoinable(((Oper *) clause->oper)->opno,
|
||||
(get_leftop(clause))->vartype,
|
||||
|
@ -7,7 +7,7 @@
|
||||
*
|
||||
*
|
||||
* IDENTIFICATION
|
||||
* $Header: /cvsroot/pgsql/src/backend/optimizer/plan/planmain.c,v 1.6 1997/09/08 02:24:37 momjian Exp $
|
||||
* $Header: /cvsroot/pgsql/src/backend/optimizer/plan/planmain.c,v 1.7 1997/09/08 21:45:24 momjian Exp $
|
||||
*
|
||||
*-------------------------------------------------------------------------
|
||||
*/
|
||||
@ -38,12 +38,12 @@
|
||||
#include "utils/mcxt.h"
|
||||
#include "utils/lsyscache.h"
|
||||
|
||||
static Plan *subplanner(Query * root, List * flat_tlist, List * qual);
|
||||
static Result *make_result(List * tlist, Node * resconstantqual, Plan * subplan);
|
||||
static Plan *subplanner(Query *root, List *flat_tlist, List *qual);
|
||||
static Result *make_result(List *tlist, Node *resconstantqual, Plan *subplan);
|
||||
|
||||
static Plan *
|
||||
make_groupPlan(List ** tlist, bool tuplePerGroup,
|
||||
List * groupClause, Plan * subplan);
|
||||
make_groupPlan(List **tlist, bool tuplePerGroup,
|
||||
List *groupClause, Plan *subplan);
|
||||
|
||||
/*
|
||||
* query_planner--
|
||||
@ -63,10 +63,10 @@ make_groupPlan(List ** tlist, bool tuplePerGroup,
|
||||
* Returns a query plan.
|
||||
*/
|
||||
Plan *
|
||||
query_planner(Query * root,
|
||||
query_planner(Query *root,
|
||||
int command_type,
|
||||
List * tlist,
|
||||
List * qual)
|
||||
List *tlist,
|
||||
List *qual)
|
||||
{
|
||||
List *constant_qual = NIL;
|
||||
List *flattened_tlist = NIL;
|
||||
@ -278,9 +278,9 @@ query_planner(Query * root,
|
||||
*
|
||||
*/
|
||||
static Plan *
|
||||
subplanner(Query * root,
|
||||
List * flat_tlist,
|
||||
List * qual)
|
||||
subplanner(Query *root,
|
||||
List *flat_tlist,
|
||||
List *qual)
|
||||
{
|
||||
Rel *final_relation;
|
||||
List *final_relation_list;
|
||||
@ -354,9 +354,9 @@ subplanner(Query * root,
|
||||
*****************************************************************************/
|
||||
|
||||
static Result *
|
||||
make_result(List * tlist,
|
||||
Node * resconstantqual,
|
||||
Plan * subplan)
|
||||
make_result(List *tlist,
|
||||
Node *resconstantqual,
|
||||
Plan *subplan)
|
||||
{
|
||||
Result *node = makeNode(Result);
|
||||
Plan *plan = &node->plan;
|
||||
@ -378,10 +378,10 @@ make_result(List * tlist,
|
||||
*****************************************************************************/
|
||||
|
||||
static Plan *
|
||||
make_groupPlan(List ** tlist,
|
||||
make_groupPlan(List **tlist,
|
||||
bool tuplePerGroup,
|
||||
List * groupClause,
|
||||
Plan * subplan)
|
||||
List *groupClause,
|
||||
Plan *subplan)
|
||||
{
|
||||
List *sort_tlist;
|
||||
List *sl,
|
||||
|
@ -7,7 +7,7 @@
|
||||
*
|
||||
*
|
||||
* IDENTIFICATION
|
||||
* $Header: /cvsroot/pgsql/src/backend/optimizer/plan/planner.c,v 1.8 1997/09/08 02:24:38 momjian Exp $
|
||||
* $Header: /cvsroot/pgsql/src/backend/optimizer/plan/planner.c,v 1.9 1997/09/08 21:45:27 momjian Exp $
|
||||
*
|
||||
*-------------------------------------------------------------------------
|
||||
*/
|
||||
@ -47,9 +47,9 @@
|
||||
|
||||
#include "executor/executor.h"
|
||||
|
||||
static Plan *make_sortplan(List * tlist, List * sortcls, Plan * plannode);
|
||||
static Plan *init_query_planner(Query * parse);
|
||||
static Existential *make_existential(Plan * left, Plan * right);
|
||||
static Plan *make_sortplan(List *tlist, List *sortcls, Plan *plannode);
|
||||
static Plan *init_query_planner(Query *parse);
|
||||
static Existential *make_existential(Plan *left, Plan *right);
|
||||
|
||||
/*****************************************************************************
|
||||
*
|
||||
@ -69,7 +69,7 @@ static Existential *make_existential(Plan * left, Plan * right);
|
||||
*
|
||||
*/
|
||||
Plan *
|
||||
planner(Query * parse)
|
||||
planner(Query *parse)
|
||||
{
|
||||
List *tlist = parse->targetList;
|
||||
List *rangetable = parse->rtable;
|
||||
@ -143,7 +143,7 @@ planner(Query * parse)
|
||||
* sortops: (sortop1 sortop2 sortop3 ...)
|
||||
*/
|
||||
static Plan *
|
||||
make_sortplan(List * tlist, List * sortcls, Plan * plannode)
|
||||
make_sortplan(List *tlist, List *sortcls, Plan *plannode)
|
||||
{
|
||||
Plan *sortplan = (Plan *) NULL;
|
||||
List *temp_tlist = NIL;
|
||||
@ -204,7 +204,7 @@ make_sortplan(List * tlist, List * sortcls, Plan * plannode)
|
||||
*
|
||||
*/
|
||||
static Plan *
|
||||
init_query_planner(Query * root)
|
||||
init_query_planner(Query *root)
|
||||
{
|
||||
List *primary_qual;
|
||||
List *existential_qual;
|
||||
@ -254,7 +254,7 @@ init_query_planner(Query * root)
|
||||
* the left and right subtree slots.
|
||||
*/
|
||||
static Existential *
|
||||
make_existential(Plan * left, Plan * right)
|
||||
make_existential(Plan *left, Plan *right)
|
||||
{
|
||||
Existential *node = makeNode(Existential);
|
||||
|
||||
@ -273,7 +273,7 @@ make_existential(Plan * left, Plan * right)
|
||||
* type he claims.
|
||||
*/
|
||||
void
|
||||
pg_checkretval(Oid rettype, QueryTreeList * queryTreeList)
|
||||
pg_checkretval(Oid rettype, QueryTreeList *queryTreeList)
|
||||
{
|
||||
Query *parse;
|
||||
List *tlist;
|
||||
@ -399,6 +399,7 @@ pg_checkretval(Oid rettype, QueryTreeList * queryTreeList)
|
||||
tletype = (Oid) ((Param *) thenode)->paramtype;
|
||||
else if (IsA(thenode, Expr))
|
||||
tletype = Expr;
|
||||
|
||||
else if (IsA(thenode, LispList))
|
||||
{
|
||||
thenode = lfirst(thenode);
|
||||
|
@ -7,7 +7,7 @@
|
||||
*
|
||||
*
|
||||
* IDENTIFICATION
|
||||
* $Header: /cvsroot/pgsql/src/backend/optimizer/plan/setrefs.c,v 1.7 1997/09/08 20:56:16 momjian Exp $
|
||||
* $Header: /cvsroot/pgsql/src/backend/optimizer/plan/setrefs.c,v 1.8 1997/09/08 21:45:28 momjian Exp $
|
||||
*
|
||||
*-------------------------------------------------------------------------
|
||||
*/
|
||||
@ -33,20 +33,20 @@
|
||||
#include "optimizer/var.h"
|
||||
#include "optimizer/tlist.h"
|
||||
|
||||
static void set_join_tlist_references(Join * join);
|
||||
static void set_tempscan_tlist_references(SeqScan * tempscan);
|
||||
static void set_temp_tlist_references(Temp * temp);
|
||||
static void set_join_tlist_references(Join *join);
|
||||
static void set_tempscan_tlist_references(SeqScan *tempscan);
|
||||
static void set_temp_tlist_references(Temp *temp);
|
||||
static List *
|
||||
replace_clause_joinvar_refs(Expr * clause,
|
||||
List * outer_tlist, List * inner_tlist);
|
||||
replace_clause_joinvar_refs(Expr *clause,
|
||||
List *outer_tlist, List *inner_tlist);
|
||||
static List *
|
||||
replace_subclause_joinvar_refs(List * clauses,
|
||||
List * outer_tlist, List * inner_tlist);
|
||||
static Var *replace_joinvar_refs(Var * var, List * outer_tlist, List * inner_tlist);
|
||||
static List *tlist_temp_references(Oid tempid, List * tlist);
|
||||
static void replace_result_clause(List * clause, List * subplanTargetList);
|
||||
static bool OperandIsInner(Node * opnd, int inner_relid);
|
||||
static void replace_agg_clause(Node * expr, List * targetlist);
|
||||
replace_subclause_joinvar_refs(List *clauses,
|
||||
List *outer_tlist, List *inner_tlist);
|
||||
static Var *replace_joinvar_refs(Var *var, List *outer_tlist, List *inner_tlist);
|
||||
static List *tlist_temp_references(Oid tempid, List *tlist);
|
||||
static void replace_result_clause(List *clause, List *subplanTargetList);
|
||||
static bool OperandIsInner(Node *opnd, int inner_relid);
|
||||
static void replace_agg_clause(Node *expr, List *targetlist);
|
||||
|
||||
/*****************************************************************************
|
||||
*
|
||||
@ -66,7 +66,7 @@ static void replace_agg_clause(Node * expr, List * targetlist);
|
||||
*
|
||||
*/
|
||||
void
|
||||
set_tlist_references(Plan * plan)
|
||||
set_tlist_references(Plan *plan)
|
||||
{
|
||||
if (plan == NULL)
|
||||
return;
|
||||
@ -75,7 +75,7 @@ set_tlist_references(Plan * plan)
|
||||
{
|
||||
set_join_tlist_references((Join *) plan);
|
||||
}
|
||||
else if (IsA(plan, SeqScan) && plan->lefttree &&
|
||||
else if (IsA(plan, SeqScan) &&plan->lefttree &&
|
||||
IsA_Temp(plan->lefttree))
|
||||
{
|
||||
set_tempscan_tlist_references((SeqScan *) plan);
|
||||
@ -120,7 +120,7 @@ set_tlist_references(Plan * plan)
|
||||
*
|
||||
*/
|
||||
static void
|
||||
set_join_tlist_references(Join * join)
|
||||
set_join_tlist_references(Join *join)
|
||||
{
|
||||
Plan *outer = ((Plan *) join)->lefttree;
|
||||
Plan *inner = ((Plan *) join)->righttree;
|
||||
@ -165,7 +165,7 @@ set_join_tlist_references(Join * join)
|
||||
*
|
||||
*/
|
||||
static void
|
||||
set_tempscan_tlist_references(SeqScan * tempscan)
|
||||
set_tempscan_tlist_references(SeqScan *tempscan)
|
||||
{
|
||||
Temp *temp = (Temp *) ((Plan *) tempscan)->lefttree;
|
||||
|
||||
@ -187,7 +187,7 @@ set_tempscan_tlist_references(SeqScan * tempscan)
|
||||
*
|
||||
*/
|
||||
static void
|
||||
set_temp_tlist_references(Temp * temp)
|
||||
set_temp_tlist_references(Temp *temp)
|
||||
{
|
||||
Plan *source = ((Plan *) temp)->lefttree;
|
||||
|
||||
@ -218,9 +218,9 @@ set_temp_tlist_references(Temp * temp)
|
||||
*
|
||||
*/
|
||||
List *
|
||||
join_references(List * clauses,
|
||||
List * outer_tlist,
|
||||
List * inner_tlist)
|
||||
join_references(List *clauses,
|
||||
List *outer_tlist,
|
||||
List *inner_tlist)
|
||||
{
|
||||
return (replace_subclause_joinvar_refs(clauses,
|
||||
outer_tlist,
|
||||
@ -244,8 +244,8 @@ join_references(List * clauses,
|
||||
*
|
||||
*/
|
||||
List *
|
||||
index_outerjoin_references(List * inner_indxqual,
|
||||
List * outer_tlist,
|
||||
index_outerjoin_references(List *inner_indxqual,
|
||||
List *outer_tlist,
|
||||
Index inner_relid)
|
||||
{
|
||||
List *t_list = NIL;
|
||||
@ -307,9 +307,9 @@ index_outerjoin_references(List * inner_indxqual,
|
||||
*
|
||||
*/
|
||||
static List *
|
||||
replace_clause_joinvar_refs(Expr * clause,
|
||||
List * outer_tlist,
|
||||
List * inner_tlist)
|
||||
replace_clause_joinvar_refs(Expr *clause,
|
||||
List *outer_tlist,
|
||||
List *inner_tlist)
|
||||
{
|
||||
List *temp = NULL;
|
||||
|
||||
@ -402,9 +402,9 @@ replace_clause_joinvar_refs(Expr * clause,
|
||||
}
|
||||
|
||||
static List *
|
||||
replace_subclause_joinvar_refs(List * clauses,
|
||||
List * outer_tlist,
|
||||
List * inner_tlist)
|
||||
replace_subclause_joinvar_refs(List *clauses,
|
||||
List *outer_tlist,
|
||||
List *inner_tlist)
|
||||
{
|
||||
List *t_list = NIL;
|
||||
List *temp = NIL;
|
||||
@ -421,7 +421,7 @@ replace_subclause_joinvar_refs(List * clauses,
|
||||
}
|
||||
|
||||
static Var *
|
||||
replace_joinvar_refs(Var * var, List * outer_tlist, List * inner_tlist)
|
||||
replace_joinvar_refs(Var *var, List *outer_tlist, List *inner_tlist)
|
||||
{
|
||||
Resdom *outer_resdom = (Resdom *) NULL;
|
||||
|
||||
@ -468,7 +468,7 @@ replace_joinvar_refs(Var * var, List * outer_tlist, List * inner_tlist)
|
||||
*/
|
||||
static List *
|
||||
tlist_temp_references(Oid tempid,
|
||||
List * tlist)
|
||||
List *tlist)
|
||||
{
|
||||
List *t_list = NIL;
|
||||
TargetEntry *temp = (TargetEntry *) NULL;
|
||||
@ -511,7 +511,7 @@ tlist_temp_references(Oid tempid,
|
||||
* fields....
|
||||
*/
|
||||
void
|
||||
set_result_tlist_references(Result * resultNode)
|
||||
set_result_tlist_references(Result *resultNode)
|
||||
{
|
||||
Plan *subplan;
|
||||
List *resultTargetList;
|
||||
@ -560,8 +560,8 @@ set_result_tlist_references(Result * resultNode)
|
||||
*
|
||||
*/
|
||||
static void
|
||||
replace_result_clause(List * clause,
|
||||
List * subplanTargetList) /* target list of the
|
||||
replace_result_clause(List *clause,
|
||||
List *subplanTargetList) /* target list of the
|
||||
* subplan */
|
||||
{
|
||||
List *t;
|
||||
@ -631,7 +631,7 @@ replace_result_clause(List * clause,
|
||||
subClause = (List *) get_rightop((Expr *) clause);
|
||||
replace_result_clause(subClause, subplanTargetList);
|
||||
}
|
||||
else if (IsA(clause, Param) || IsA(clause, Const))
|
||||
else if (IsA(clause, Param) ||IsA(clause, Const))
|
||||
{
|
||||
/* do nothing! */
|
||||
}
|
||||
@ -646,8 +646,8 @@ replace_result_clause(List * clause,
|
||||
}
|
||||
|
||||
static
|
||||
bool
|
||||
OperandIsInner(Node * opnd, int inner_relid)
|
||||
bool
|
||||
OperandIsInner(Node *opnd, int inner_relid)
|
||||
{
|
||||
|
||||
/*
|
||||
@ -720,7 +720,7 @@ set_agg_agglist_references(Agg *aggNode)
|
||||
}
|
||||
|
||||
static void
|
||||
replace_agg_clause(Node * clause, List * subplanTargetList)
|
||||
replace_agg_clause(Node *clause, List *subplanTargetList)
|
||||
{
|
||||
List *t;
|
||||
TargetEntry *subplanVar;
|
||||
@ -789,7 +789,7 @@ replace_agg_clause(Node * clause, List * subplanTargetList)
|
||||
if (right != (Node *) NULL)
|
||||
replace_agg_clause(right, subplanTargetList);
|
||||
}
|
||||
else if (IsA(clause, Param) || IsA(clause, Const))
|
||||
else if (IsA(clause, Param) ||IsA(clause, Const))
|
||||
{
|
||||
/* do nothing! */
|
||||
}
|
||||
|
@ -7,7 +7,7 @@
|
||||
*
|
||||
*
|
||||
* IDENTIFICATION
|
||||
* $Header: /cvsroot/pgsql/src/backend/optimizer/prep/Attic/archive.c,v 1.3 1997/09/08 02:24:41 momjian Exp $
|
||||
* $Header: /cvsroot/pgsql/src/backend/optimizer/prep/Attic/archive.c,v 1.4 1997/09/08 21:45:29 momjian Exp $
|
||||
*
|
||||
*-------------------------------------------------------------------------
|
||||
*/
|
||||
@ -26,7 +26,7 @@
|
||||
#include "commands/creatinh.h"
|
||||
|
||||
void
|
||||
plan_archive(List * rt)
|
||||
plan_archive(List *rt)
|
||||
{
|
||||
List *rtitem;
|
||||
RangeTblEntry *rte;
|
||||
|
@ -7,7 +7,7 @@
|
||||
*
|
||||
*
|
||||
* IDENTIFICATION
|
||||
* $Header: /cvsroot/pgsql/src/backend/optimizer/prep/prepqual.c,v 1.5 1997/09/08 02:24:42 momjian Exp $
|
||||
* $Header: /cvsroot/pgsql/src/backend/optimizer/prep/prepqual.c,v 1.6 1997/09/08 21:45:31 momjian Exp $
|
||||
*
|
||||
*-------------------------------------------------------------------------
|
||||
*/
|
||||
@ -24,17 +24,17 @@
|
||||
|
||||
#include "utils/lsyscache.h"
|
||||
|
||||
static Expr *pull_args(Expr * qual);
|
||||
static List *pull_ors(List * orlist);
|
||||
static List *pull_ands(List * andlist);
|
||||
static Expr *find_nots(Expr * qual);
|
||||
static Expr *push_nots(Expr * qual);
|
||||
static Expr *normalize(Expr * qual);
|
||||
static List *or_normalize(List * orlist);
|
||||
static List *distribute_args(List * item, List * args);
|
||||
static List *qualcleanup(Expr * qual);
|
||||
static List *remove_ands(Expr * qual);
|
||||
static List *remove_duplicates(List * list);
|
||||
static Expr *pull_args(Expr *qual);
|
||||
static List *pull_ors(List *orlist);
|
||||
static List *pull_ands(List *andlist);
|
||||
static Expr *find_nots(Expr *qual);
|
||||
static Expr *push_nots(Expr *qual);
|
||||
static Expr *normalize(Expr *qual);
|
||||
static List *or_normalize(List *orlist);
|
||||
static List *distribute_args(List *item, List *args);
|
||||
static List *qualcleanup(Expr *qual);
|
||||
static List *remove_ands(Expr *qual);
|
||||
static List *remove_duplicates(List *list);
|
||||
|
||||
/*
|
||||
* preprocess-qualification--
|
||||
@ -48,7 +48,7 @@ static List *remove_duplicates(List * list);
|
||||
* normal form (see cnfify() below )
|
||||
*/
|
||||
List *
|
||||
preprocess_qualification(Expr * qual, List * tlist, List ** existentialQualPtr)
|
||||
preprocess_qualification(Expr *qual, List *tlist, List **existentialQualPtr)
|
||||
{
|
||||
List *cnf_qual = cnfify(qual, true);
|
||||
|
||||
@ -101,7 +101,7 @@ preprocess_qualification(Expr * qual, List * tlist, List ** existentialQualPtr)
|
||||
*
|
||||
*/
|
||||
List *
|
||||
cnfify(Expr * qual, bool removeAndFlag)
|
||||
cnfify(Expr *qual, bool removeAndFlag)
|
||||
{
|
||||
Expr *newqual = NULL;
|
||||
|
||||
@ -134,7 +134,7 @@ cnfify(Expr * qual, bool removeAndFlag)
|
||||
*
|
||||
*/
|
||||
static Expr *
|
||||
pull_args(Expr * qual)
|
||||
pull_args(Expr *qual)
|
||||
{
|
||||
if (qual == NULL)
|
||||
return (NULL);
|
||||
@ -182,7 +182,7 @@ pull_args(Expr * qual)
|
||||
* Returns the modified list.
|
||||
*/
|
||||
static List *
|
||||
pull_ors(List * orlist)
|
||||
pull_ors(List *orlist)
|
||||
{
|
||||
if (orlist == NIL)
|
||||
return (NIL);
|
||||
@ -208,7 +208,7 @@ pull_ors(List * orlist)
|
||||
* Returns the modified list.
|
||||
*/
|
||||
static List *
|
||||
pull_ands(List * andlist)
|
||||
pull_ands(List *andlist)
|
||||
{
|
||||
if (andlist == NIL)
|
||||
return (NIL);
|
||||
@ -237,7 +237,7 @@ pull_ands(List * andlist)
|
||||
*
|
||||
*/
|
||||
static Expr *
|
||||
find_nots(Expr * qual)
|
||||
find_nots(Expr *qual)
|
||||
{
|
||||
if (qual == NULL)
|
||||
return (NULL);
|
||||
@ -286,7 +286,7 @@ find_nots(Expr * qual)
|
||||
*
|
||||
*/
|
||||
static Expr *
|
||||
push_nots(Expr * qual)
|
||||
push_nots(Expr *qual)
|
||||
{
|
||||
if (qual == NULL)
|
||||
return (NULL);
|
||||
@ -373,7 +373,7 @@ push_nots(Expr * qual)
|
||||
*
|
||||
*/
|
||||
static Expr *
|
||||
normalize(Expr * qual)
|
||||
normalize(Expr *qual)
|
||||
{
|
||||
if (qual == NULL)
|
||||
return (NULL);
|
||||
@ -438,7 +438,7 @@ normalize(Expr * qual)
|
||||
*
|
||||
*/
|
||||
static List *
|
||||
or_normalize(List * orlist)
|
||||
or_normalize(List *orlist)
|
||||
{
|
||||
List *distributable = NIL;
|
||||
List *new_orlist = NIL;
|
||||
@ -477,7 +477,7 @@ or_normalize(List * orlist)
|
||||
*
|
||||
*/
|
||||
static List *
|
||||
distribute_args(List * item, List * args)
|
||||
distribute_args(List *item, List *args)
|
||||
{
|
||||
List *or_list = NIL;
|
||||
List *n_list = NIL;
|
||||
@ -507,7 +507,7 @@ distribute_args(List * item, List * args)
|
||||
*
|
||||
*/
|
||||
static List *
|
||||
qualcleanup(Expr * qual)
|
||||
qualcleanup(Expr *qual)
|
||||
{
|
||||
if (qual == NULL)
|
||||
return (NIL);
|
||||
@ -568,7 +568,7 @@ qualcleanup(Expr * qual)
|
||||
* MODIFIES: qual
|
||||
*/
|
||||
static List *
|
||||
remove_ands(Expr * qual)
|
||||
remove_ands(Expr *qual)
|
||||
{
|
||||
List *t_list = NIL;
|
||||
|
||||
@ -621,7 +621,7 @@ remove_ands(Expr * qual)
|
||||
*/
|
||||
#ifdef NOT_USED
|
||||
static List *
|
||||
update_relations(List * tlist)
|
||||
update_relations(List *tlist)
|
||||
{
|
||||
return (NIL);
|
||||
}
|
||||
@ -635,7 +635,7 @@ update_relations(List * tlist)
|
||||
*****************************************************************************/
|
||||
|
||||
static List *
|
||||
remove_duplicates(List * list)
|
||||
remove_duplicates(List *list)
|
||||
{
|
||||
List *i;
|
||||
List *j;
|
||||
|
@ -7,7 +7,7 @@
|
||||
*
|
||||
*
|
||||
* IDENTIFICATION
|
||||
* $Header: /cvsroot/pgsql/src/backend/optimizer/prep/preptlist.c,v 1.4 1997/09/08 02:24:44 momjian Exp $
|
||||
* $Header: /cvsroot/pgsql/src/backend/optimizer/prep/preptlist.c,v 1.5 1997/09/08 21:45:36 momjian Exp $
|
||||
*
|
||||
*-------------------------------------------------------------------------
|
||||
*/
|
||||
@ -34,11 +34,11 @@
|
||||
#include "optimizer/tlist.h"
|
||||
|
||||
static List *
|
||||
expand_targetlist(List * tlist, Oid relid, int command_type,
|
||||
expand_targetlist(List *tlist, Oid relid, int command_type,
|
||||
Index result_relation);
|
||||
static List *
|
||||
replace_matching_resname(List * new_tlist,
|
||||
List * old_tlist);
|
||||
replace_matching_resname(List *new_tlist,
|
||||
List *old_tlist);
|
||||
static List *
|
||||
new_relation_targetlist(Oid relid, Index rt_index,
|
||||
NodeTag node_type);
|
||||
@ -55,10 +55,10 @@ new_relation_targetlist(Oid relid, Index rt_index,
|
||||
* Returns the new targetlist.
|
||||
*/
|
||||
List *
|
||||
preprocess_targetlist(List * tlist,
|
||||
preprocess_targetlist(List *tlist,
|
||||
int command_type,
|
||||
Index result_relation,
|
||||
List * range_table)
|
||||
List *range_table)
|
||||
{
|
||||
List *expanded_tlist = NIL;
|
||||
Oid relid = InvalidOid;
|
||||
@ -144,7 +144,7 @@ preprocess_targetlist(List * tlist,
|
||||
* Returns the expanded target list, sorted in resno order.
|
||||
*/
|
||||
static List *
|
||||
expand_targetlist(List * tlist,
|
||||
expand_targetlist(List *tlist,
|
||||
Oid relid,
|
||||
int command_type,
|
||||
Index result_relation)
|
||||
@ -178,7 +178,7 @@ expand_targetlist(List * tlist,
|
||||
|
||||
|
||||
static List *
|
||||
replace_matching_resname(List * new_tlist, List * old_tlist)
|
||||
replace_matching_resname(List *new_tlist, List *old_tlist)
|
||||
{
|
||||
List *temp,
|
||||
*i;
|
||||
|
@ -7,7 +7,7 @@
|
||||
*
|
||||
*
|
||||
* IDENTIFICATION
|
||||
* $Header: /cvsroot/pgsql/src/backend/optimizer/prep/prepunion.c,v 1.5 1997/09/08 02:24:47 momjian Exp $
|
||||
* $Header: /cvsroot/pgsql/src/backend/optimizer/prep/prepunion.c,v 1.6 1997/09/08 21:45:37 momjian Exp $
|
||||
*
|
||||
*-------------------------------------------------------------------------
|
||||
*/
|
||||
@ -35,21 +35,21 @@
|
||||
#include "optimizer/prep.h"
|
||||
|
||||
static List *
|
||||
plan_union_query(List * relids, Index rt_index,
|
||||
RangeTblEntry * rt_entry, Query * parse, UnionFlag flag,
|
||||
List ** union_rtentriesPtr);
|
||||
plan_union_query(List *relids, Index rt_index,
|
||||
RangeTblEntry *rt_entry, Query *parse, UnionFlag flag,
|
||||
List **union_rtentriesPtr);
|
||||
static RangeTblEntry *
|
||||
new_rangetable_entry(Oid new_relid,
|
||||
RangeTblEntry * old_entry);
|
||||
RangeTblEntry *old_entry);
|
||||
static Query *
|
||||
subst_rangetable(Query * root, Index index,
|
||||
RangeTblEntry * new_entry);
|
||||
subst_rangetable(Query *root, Index index,
|
||||
RangeTblEntry *new_entry);
|
||||
static void
|
||||
fix_parsetree_attnums(Index rt_index, Oid old_relid,
|
||||
Oid new_relid, Query * parsetree);
|
||||
Oid new_relid, Query *parsetree);
|
||||
static Append *
|
||||
make_append(List * unionplans, Index rt_index,
|
||||
List * union_rt_entries, List * tlist);
|
||||
make_append(List *unionplans, Index rt_index,
|
||||
List *union_rt_entries, List *tlist);
|
||||
|
||||
|
||||
/*
|
||||
@ -59,8 +59,8 @@ make_append(List * unionplans, Index rt_index,
|
||||
* lists.
|
||||
*/
|
||||
List *
|
||||
find_all_inheritors(List * unexamined_relids,
|
||||
List * examined_relids)
|
||||
find_all_inheritors(List *unexamined_relids,
|
||||
List *examined_relids)
|
||||
{
|
||||
List *new_inheritors = NIL;
|
||||
List *new_examined_relids = NIL;
|
||||
@ -103,7 +103,7 @@ find_all_inheritors(List * unexamined_relids,
|
||||
* Returns a rangetable index., Returns -1 if no matches
|
||||
*/
|
||||
int
|
||||
first_matching_rt_entry(List * rangetable, UnionFlag flag)
|
||||
first_matching_rt_entry(List *rangetable, UnionFlag flag)
|
||||
{
|
||||
int count = 0;
|
||||
List *temp = NIL;
|
||||
@ -143,7 +143,7 @@ first_matching_rt_entry(List * rangetable, UnionFlag flag)
|
||||
*/
|
||||
Append *
|
||||
plan_union_queries(Index rt_index,
|
||||
Query * parse,
|
||||
Query *parse,
|
||||
UnionFlag flag)
|
||||
{
|
||||
List *rangetable = parse->rtable;
|
||||
@ -226,12 +226,12 @@ plan_union_queries(Index rt_index,
|
||||
* in union_rtentries.
|
||||
*/
|
||||
static List *
|
||||
plan_union_query(List * relids,
|
||||
plan_union_query(List *relids,
|
||||
Index rt_index,
|
||||
RangeTblEntry * rt_entry,
|
||||
Query * root,
|
||||
RangeTblEntry *rt_entry,
|
||||
Query *root,
|
||||
UnionFlag flag,
|
||||
List ** union_rtentriesPtr)
|
||||
List **union_rtentriesPtr)
|
||||
{
|
||||
List *i;
|
||||
List *union_plans = NIL;
|
||||
@ -286,7 +286,7 @@ plan_union_query(List * relids,
|
||||
* Returns a copy of 'old-entry' with the parameters substituted.
|
||||
*/
|
||||
static RangeTblEntry *
|
||||
new_rangetable_entry(Oid new_relid, RangeTblEntry * old_entry)
|
||||
new_rangetable_entry(Oid new_relid, RangeTblEntry *old_entry)
|
||||
{
|
||||
RangeTblEntry *new_entry = copyObject(old_entry);
|
||||
|
||||
@ -308,7 +308,7 @@ new_rangetable_entry(Oid new_relid, RangeTblEntry * old_entry)
|
||||
* Returns a new copy of 'root'.
|
||||
*/
|
||||
static Query *
|
||||
subst_rangetable(Query * root, Index index, RangeTblEntry * new_entry)
|
||||
subst_rangetable(Query *root, Index index, RangeTblEntry *new_entry)
|
||||
{
|
||||
Query *new_root = copyObject(root);
|
||||
List *temp = NIL;
|
||||
@ -325,7 +325,7 @@ static void
|
||||
fix_parsetree_attnums_nodes(Index rt_index,
|
||||
Oid old_relid,
|
||||
Oid new_relid,
|
||||
Node * node)
|
||||
Node *node)
|
||||
{
|
||||
if (node == NULL)
|
||||
return;
|
||||
@ -396,7 +396,7 @@ static void
|
||||
fix_parsetree_attnums(Index rt_index,
|
||||
Oid old_relid,
|
||||
Oid new_relid,
|
||||
Query * parsetree)
|
||||
Query *parsetree)
|
||||
{
|
||||
if (old_relid == new_relid)
|
||||
return;
|
||||
@ -408,10 +408,10 @@ fix_parsetree_attnums(Index rt_index,
|
||||
}
|
||||
|
||||
static Append *
|
||||
make_append(List * unionplans,
|
||||
make_append(List *unionplans,
|
||||
Index rt_index,
|
||||
List * union_rt_entries,
|
||||
List * tlist)
|
||||
List *union_rt_entries,
|
||||
List *tlist)
|
||||
{
|
||||
Append *node = makeNode(Append);
|
||||
|
||||
|
@ -7,7 +7,7 @@
|
||||
*
|
||||
*
|
||||
* IDENTIFICATION
|
||||
* $Header: /cvsroot/pgsql/src/backend/optimizer/util/Attic/clauseinfo.c,v 1.5 1997/09/08 02:24:48 momjian Exp $
|
||||
* $Header: /cvsroot/pgsql/src/backend/optimizer/util/Attic/clauseinfo.c,v 1.6 1997/09/08 21:45:44 momjian Exp $
|
||||
*
|
||||
*-------------------------------------------------------------------------
|
||||
*/
|
||||
@ -27,7 +27,7 @@
|
||||
*
|
||||
*/
|
||||
bool
|
||||
valid_or_clause(CInfo * clauseinfo)
|
||||
valid_or_clause(CInfo *clauseinfo)
|
||||
{
|
||||
if (clauseinfo != NULL &&
|
||||
!single_node((Node *) clauseinfo->clause) &&
|
||||
@ -45,7 +45,7 @@ valid_or_clause(CInfo * clauseinfo)
|
||||
*
|
||||
*/
|
||||
List *
|
||||
get_actual_clauses(List * clauseinfo_list)
|
||||
get_actual_clauses(List *clauseinfo_list)
|
||||
{
|
||||
List *temp = NIL;
|
||||
List *result = NIL;
|
||||
@ -85,10 +85,10 @@ get_actual_clauses(List * clauseinfo_list)
|
||||
*
|
||||
*/
|
||||
void
|
||||
get_relattvals(List * clauseinfo_list,
|
||||
List ** attnos,
|
||||
List ** values,
|
||||
List ** flags)
|
||||
get_relattvals(List *clauseinfo_list,
|
||||
List **attnos,
|
||||
List **values,
|
||||
List **flags)
|
||||
{
|
||||
List *result1 = NIL;
|
||||
List *result2 = NIL;
|
||||
@ -132,10 +132,10 @@ get_relattvals(List * clauseinfo_list,
|
||||
*/
|
||||
void
|
||||
get_joinvars(Oid relid,
|
||||
List * clauseinfo_list,
|
||||
List ** attnos,
|
||||
List ** values,
|
||||
List ** flags)
|
||||
List *clauseinfo_list,
|
||||
List **attnos,
|
||||
List **values,
|
||||
List **flags)
|
||||
{
|
||||
List *result1 = NIL;
|
||||
List *result2 = NIL;
|
||||
@ -174,7 +174,7 @@ get_joinvars(Oid relid,
|
||||
*
|
||||
*/
|
||||
List *
|
||||
get_opnos(List * clauseinfo_list)
|
||||
get_opnos(List *clauseinfo_list)
|
||||
{
|
||||
CInfo *temp = (CInfo *) NULL;
|
||||
List *result = NIL;
|
||||
|
@ -7,7 +7,7 @@
|
||||
*
|
||||
*
|
||||
* IDENTIFICATION
|
||||
* $Header: /cvsroot/pgsql/src/backend/optimizer/util/clauses.c,v 1.10 1997/09/08 20:56:19 momjian Exp $
|
||||
* $Header: /cvsroot/pgsql/src/backend/optimizer/util/clauses.c,v 1.11 1997/09/08 21:45:47 momjian Exp $
|
||||
*
|
||||
* HISTORY
|
||||
* AUTHOR DATE MAJOR EVENT
|
||||
@ -34,11 +34,11 @@
|
||||
#include "optimizer/internal.h"
|
||||
#include "optimizer/var.h"
|
||||
|
||||
static bool agg_clause(Node * clause);
|
||||
static bool agg_clause(Node *clause);
|
||||
|
||||
|
||||
Expr *
|
||||
make_clause(int type, Node * oper, List * args)
|
||||
make_clause(int type, Node *oper, List *args)
|
||||
{
|
||||
if (type == AND_EXPR || type == OR_EXPR || type == NOT_EXPR ||
|
||||
type == OP_EXPR || type == FUNC_EXPR)
|
||||
@ -79,11 +79,11 @@ make_clause(int type, Node * oper, List * args)
|
||||
* - ay 10/94.]
|
||||
*/
|
||||
bool
|
||||
is_opclause(Node * clause)
|
||||
is_opclause(Node *clause)
|
||||
{
|
||||
return
|
||||
(clause != NULL &&
|
||||
nodeTag(clause) == T_Expr && ((Expr *) clause)->opType == OP_EXPR);
|
||||
(clause != NULL &&
|
||||
nodeTag(clause) == T_Expr && ((Expr *) clause)->opType == OP_EXPR);
|
||||
}
|
||||
|
||||
/*
|
||||
@ -93,7 +93,7 @@ is_opclause(Node * clause)
|
||||
*
|
||||
*/
|
||||
Expr *
|
||||
make_opclause(Oper * op, Var * leftop, Var * rightop)
|
||||
make_opclause(Oper *op, Var *leftop, Var *rightop)
|
||||
{
|
||||
Expr *expr = makeNode(Expr);
|
||||
|
||||
@ -112,7 +112,7 @@ make_opclause(Oper * op, Var * leftop, Var * rightop)
|
||||
* NB: it is assumed (for now) that all expr must be Var nodes
|
||||
*/
|
||||
Var *
|
||||
get_leftop(Expr * clause)
|
||||
get_leftop(Expr *clause)
|
||||
{
|
||||
if (clause->args != NULL)
|
||||
return (lfirst(clause->args));
|
||||
@ -127,7 +127,7 @@ get_leftop(Expr * clause)
|
||||
*
|
||||
*/
|
||||
Var *
|
||||
get_rightop(Expr * clause)
|
||||
get_rightop(Expr *clause)
|
||||
{
|
||||
if (clause->args != NULL && lnext(clause->args) != NULL)
|
||||
return (lfirst(lnext(clause->args)));
|
||||
@ -140,7 +140,7 @@ get_rightop(Expr * clause)
|
||||
*****************************************************************************/
|
||||
|
||||
static bool
|
||||
agg_clause(Node * clause)
|
||||
agg_clause(Node *clause)
|
||||
{
|
||||
return
|
||||
(clause != NULL && nodeTag(clause) == T_Aggreg);
|
||||
@ -157,11 +157,11 @@ agg_clause(Node * clause)
|
||||
*
|
||||
*/
|
||||
bool
|
||||
is_funcclause(Node * clause)
|
||||
is_funcclause(Node *clause)
|
||||
{
|
||||
return
|
||||
(clause != NULL &&
|
||||
nodeTag(clause) == T_Expr && ((Expr *) clause)->opType == FUNC_EXPR);
|
||||
(clause != NULL &&
|
||||
nodeTag(clause) == T_Expr && ((Expr *) clause)->opType == FUNC_EXPR);
|
||||
}
|
||||
|
||||
/*
|
||||
@ -172,7 +172,7 @@ is_funcclause(Node * clause)
|
||||
*
|
||||
*/
|
||||
Expr *
|
||||
make_funcclause(Func * func, List * funcargs)
|
||||
make_funcclause(Func *func, List *funcargs)
|
||||
{
|
||||
Expr *expr = makeNode(Expr);
|
||||
|
||||
@ -194,11 +194,11 @@ make_funcclause(Func * func, List * funcargs)
|
||||
*
|
||||
*/
|
||||
bool
|
||||
or_clause(Node * clause)
|
||||
or_clause(Node *clause)
|
||||
{
|
||||
return
|
||||
(clause != NULL &&
|
||||
nodeTag(clause) == T_Expr && ((Expr *) clause)->opType == OR_EXPR);
|
||||
(clause != NULL &&
|
||||
nodeTag(clause) == T_Expr && ((Expr *) clause)->opType == OR_EXPR);
|
||||
}
|
||||
|
||||
/*
|
||||
@ -208,7 +208,7 @@ or_clause(Node * clause)
|
||||
*
|
||||
*/
|
||||
Expr *
|
||||
make_orclause(List * orclauses)
|
||||
make_orclause(List *orclauses)
|
||||
{
|
||||
Expr *expr = makeNode(Expr);
|
||||
|
||||
@ -230,10 +230,10 @@ make_orclause(List * orclauses)
|
||||
*
|
||||
*/
|
||||
bool
|
||||
not_clause(Node * clause)
|
||||
not_clause(Node *clause)
|
||||
{
|
||||
return
|
||||
(clause != NULL &&
|
||||
(clause != NULL &&
|
||||
nodeTag(clause) == T_Expr && ((Expr *) clause)->opType == NOT_EXPR);
|
||||
}
|
||||
|
||||
@ -244,7 +244,7 @@ not_clause(Node * clause)
|
||||
*
|
||||
*/
|
||||
Expr *
|
||||
make_notclause(Expr * notclause)
|
||||
make_notclause(Expr *notclause)
|
||||
{
|
||||
Expr *expr = makeNode(Expr);
|
||||
|
||||
@ -262,7 +262,7 @@ make_notclause(Expr * notclause)
|
||||
*
|
||||
*/
|
||||
Expr *
|
||||
get_notclausearg(Expr * notclause)
|
||||
get_notclausearg(Expr *notclause)
|
||||
{
|
||||
return (lfirst(notclause->args));
|
||||
}
|
||||
@ -279,10 +279,10 @@ get_notclausearg(Expr * notclause)
|
||||
*
|
||||
*/
|
||||
bool
|
||||
and_clause(Node * clause)
|
||||
and_clause(Node *clause)
|
||||
{
|
||||
return
|
||||
(clause != NULL &&
|
||||
(clause != NULL &&
|
||||
nodeTag(clause) == T_Expr && ((Expr *) clause)->opType == AND_EXPR);
|
||||
}
|
||||
|
||||
@ -293,7 +293,7 @@ and_clause(Node * clause)
|
||||
*
|
||||
*/
|
||||
Expr *
|
||||
make_andclause(List * andclauses)
|
||||
make_andclause(List *andclauses)
|
||||
{
|
||||
Expr *expr = makeNode(Expr);
|
||||
|
||||
@ -321,7 +321,7 @@ make_andclause(List * andclauses)
|
||||
*
|
||||
*/
|
||||
List *
|
||||
pull_constant_clauses(List * quals, List ** constantQual)
|
||||
pull_constant_clauses(List *quals, List **constantQual)
|
||||
{
|
||||
List *q;
|
||||
List *constqual = NIL;
|
||||
@ -356,7 +356,7 @@ pull_constant_clauses(List * quals, List ** constantQual)
|
||||
*
|
||||
*/
|
||||
void
|
||||
clause_relids_vars(Node * clause, List ** relids, List ** vars)
|
||||
clause_relids_vars(Node *clause, List **relids, List **vars)
|
||||
{
|
||||
List *clvars = pull_var_clause(clause);
|
||||
List *var_list = NIL;
|
||||
@ -396,7 +396,7 @@ clause_relids_vars(Node * clause, List ** relids, List ** vars)
|
||||
* Returns the number of different relations referenced in 'clause'.
|
||||
*/
|
||||
int
|
||||
NumRelids(Node * clause)
|
||||
NumRelids(Node *clause)
|
||||
{
|
||||
List *vars = pull_var_clause(clause);
|
||||
List *i = NIL;
|
||||
@ -423,7 +423,7 @@ NumRelids(Node * clause)
|
||||
*
|
||||
*/
|
||||
bool
|
||||
contains_not(Node * clause)
|
||||
contains_not(Node *clause)
|
||||
{
|
||||
if (single_node(clause))
|
||||
return (false);
|
||||
@ -452,7 +452,7 @@ contains_not(Node * clause)
|
||||
*
|
||||
*/
|
||||
bool
|
||||
join_clause_p(Node * clause)
|
||||
join_clause_p(Node *clause)
|
||||
{
|
||||
Node *leftop,
|
||||
*rightop;
|
||||
@ -467,7 +467,7 @@ join_clause_p(Node * clause)
|
||||
* One side of the clause (i.e. left or right operands) must either be
|
||||
* a var node ...
|
||||
*/
|
||||
if (IsA(leftop, Var) || IsA(rightop, Var))
|
||||
if (IsA(leftop, Var) ||IsA(rightop, Var))
|
||||
return true;
|
||||
|
||||
/*
|
||||
@ -486,7 +486,7 @@ join_clause_p(Node * clause)
|
||||
*
|
||||
*/
|
||||
bool
|
||||
qual_clause_p(Node * clause)
|
||||
qual_clause_p(Node *clause)
|
||||
{
|
||||
if (!is_opclause(clause))
|
||||
return false;
|
||||
@ -512,7 +512,7 @@ qual_clause_p(Node * clause)
|
||||
*
|
||||
*/
|
||||
void
|
||||
fix_opid(Node * clause)
|
||||
fix_opid(Node *clause)
|
||||
{
|
||||
if (clause == NULL || single_node(clause))
|
||||
{
|
||||
@ -560,7 +560,7 @@ fix_opid(Node * clause)
|
||||
*
|
||||
*/
|
||||
List *
|
||||
fix_opids(List * clauses)
|
||||
fix_opids(List *clauses)
|
||||
{
|
||||
List *clause;
|
||||
|
||||
@ -595,10 +595,10 @@ fix_opids(List * clauses)
|
||||
*
|
||||
*/
|
||||
void
|
||||
get_relattval(Node * clause,
|
||||
get_relattval(Node *clause,
|
||||
int *relid,
|
||||
AttrNumber *attno,
|
||||
Datum * constval,
|
||||
Datum *constval,
|
||||
int *flag)
|
||||
{
|
||||
Var *left = get_leftop((Expr *) clause);
|
||||
@ -628,7 +628,7 @@ get_relattval(Node * clause,
|
||||
}
|
||||
#ifdef INDEXSCAN_PATCH
|
||||
}
|
||||
else if (is_opclause(clause) && IsA(left, Var) && IsA(right, Param))
|
||||
else if (is_opclause(clause) && IsA(left, Var) &&IsA(right, Param))
|
||||
{
|
||||
/* Function parameter used as index scan arg. DZ - 27-8-1996 */
|
||||
*relid = left->varno;
|
||||
@ -691,7 +691,7 @@ get_relattval(Node * clause,
|
||||
}
|
||||
#ifdef INDEXSCAN_PATCH
|
||||
}
|
||||
else if (is_opclause(clause) && IsA(right, Var) && IsA(left, Param))
|
||||
else if (is_opclause(clause) && IsA(right, Var) &&IsA(left, Param))
|
||||
{
|
||||
/* ...And here... - vadim 01/22/97 */
|
||||
*relid = right->varno;
|
||||
@ -726,7 +726,7 @@ get_relattval(Node * clause,
|
||||
*
|
||||
*/
|
||||
void
|
||||
get_rels_atts(Node * clause,
|
||||
get_rels_atts(Node *clause,
|
||||
int *relid1,
|
||||
AttrNumber *attno1,
|
||||
int *relid2,
|
||||
@ -736,9 +736,9 @@ get_rels_atts(Node * clause,
|
||||
Var *right = get_rightop((Expr *) clause);
|
||||
bool var_left = (IsA(left, Var));
|
||||
bool var_right = (IsA(right, Var));
|
||||
bool varexpr_left = (bool) ((IsA(left, Func) || IsA(left, Oper)) &&
|
||||
bool varexpr_left = (bool) ((IsA(left, Func) ||IsA(left, Oper)) &&
|
||||
contain_var_clause((Node *) left));
|
||||
bool varexpr_right = (bool) ((IsA(right, Func) || IsA(right, Oper)) &&
|
||||
bool varexpr_right = (bool) ((IsA(right, Func) ||IsA(right, Oper)) &&
|
||||
contain_var_clause((Node *) right));
|
||||
|
||||
if (is_opclause(clause))
|
||||
@ -780,7 +780,7 @@ get_rels_atts(Node * clause,
|
||||
}
|
||||
|
||||
void
|
||||
CommuteClause(Node * clause)
|
||||
CommuteClause(Node *clause)
|
||||
{
|
||||
Node *temp;
|
||||
Oper *commu;
|
||||
|
@ -7,7 +7,7 @@
|
||||
*
|
||||
*
|
||||
* IDENTIFICATION
|
||||
* $Header: /cvsroot/pgsql/src/backend/optimizer/util/Attic/indexnode.c,v 1.4 1997/09/08 02:24:54 momjian Exp $
|
||||
* $Header: /cvsroot/pgsql/src/backend/optimizer/util/Attic/indexnode.c,v 1.5 1997/09/08 21:45:48 momjian Exp $
|
||||
*
|
||||
*-------------------------------------------------------------------------
|
||||
*/
|
||||
@ -24,7 +24,7 @@
|
||||
#include "optimizer/pathnode.h" /* where the decls go */
|
||||
|
||||
|
||||
static List *find_secondary_index(Query * root, Oid relid);
|
||||
static List *find_secondary_index(Query *root, Oid relid);
|
||||
|
||||
/*
|
||||
* find-relation-indices--
|
||||
@ -33,7 +33,7 @@ static List *find_secondary_index(Query * root, Oid relid);
|
||||
*
|
||||
*/
|
||||
List *
|
||||
find_relation_indices(Query * root, Rel * rel)
|
||||
find_relation_indices(Query *root, Rel *rel)
|
||||
{
|
||||
if (rel->indexed)
|
||||
{
|
||||
@ -57,7 +57,7 @@ find_relation_indices(Query * root, Rel * rel)
|
||||
*
|
||||
*/
|
||||
static List *
|
||||
find_secondary_index(Query * root, Oid relid)
|
||||
find_secondary_index(Query *root, Oid relid)
|
||||
{
|
||||
IdxInfoRetval indexinfo;
|
||||
List *indexes = NIL;
|
||||
|
@ -7,7 +7,7 @@
|
||||
*
|
||||
*
|
||||
* IDENTIFICATION
|
||||
* $Header: /cvsroot/pgsql/src/backend/optimizer/util/Attic/internal.c,v 1.5 1997/09/08 02:24:56 momjian Exp $
|
||||
* $Header: /cvsroot/pgsql/src/backend/optimizer/util/Attic/internal.c,v 1.6 1997/09/08 21:45:49 momjian Exp $
|
||||
*
|
||||
*-------------------------------------------------------------------------
|
||||
*/
|
||||
@ -39,7 +39,7 @@
|
||||
/* the following should probably be moved elsewhere -ay */
|
||||
|
||||
TargetEntry *
|
||||
MakeTLE(Resdom * resdom, Node * expr)
|
||||
MakeTLE(Resdom *resdom, Node *expr)
|
||||
{
|
||||
TargetEntry *rt = makeNode(TargetEntry);
|
||||
|
||||
@ -49,7 +49,7 @@ MakeTLE(Resdom * resdom, Node * expr)
|
||||
}
|
||||
|
||||
Var *
|
||||
get_expr(TargetEntry * tle)
|
||||
get_expr(TargetEntry *tle)
|
||||
{
|
||||
Assert(tle != NULL);
|
||||
Assert(tle->expr != NULL);
|
||||
|
@ -7,7 +7,7 @@
|
||||
*
|
||||
*
|
||||
* IDENTIFICATION
|
||||
* $Header: /cvsroot/pgsql/src/backend/optimizer/util/joininfo.c,v 1.4 1997/09/08 02:24:57 momjian Exp $
|
||||
* $Header: /cvsroot/pgsql/src/backend/optimizer/util/joininfo.c,v 1.5 1997/09/08 21:45:50 momjian Exp $
|
||||
*
|
||||
*-------------------------------------------------------------------------
|
||||
*/
|
||||
@ -36,7 +36,7 @@
|
||||
*
|
||||
*/
|
||||
JInfo *
|
||||
joininfo_member(List * join_relids, List * joininfo_list)
|
||||
joininfo_member(List *join_relids, List *joininfo_list)
|
||||
{
|
||||
List *i = NIL;
|
||||
List *other_rels = NIL;
|
||||
@ -62,7 +62,7 @@ joininfo_member(List * join_relids, List * joininfo_list)
|
||||
*
|
||||
*/
|
||||
JInfo *
|
||||
find_joininfo_node(Rel * this_rel, List * join_relids)
|
||||
find_joininfo_node(Rel *this_rel, List *join_relids)
|
||||
{
|
||||
JInfo *joininfo = joininfo_member(join_relids,
|
||||
this_rel->joininfo);
|
||||
@ -89,7 +89,7 @@ find_joininfo_node(Rel * this_rel, List * join_relids)
|
||||
*
|
||||
*/
|
||||
Var *
|
||||
other_join_clause_var(Var * var, Expr * clause)
|
||||
other_join_clause_var(Var *var, Expr *clause)
|
||||
{
|
||||
Var *retval;
|
||||
Var *l,
|
||||
|
@ -7,7 +7,7 @@
|
||||
*
|
||||
*
|
||||
* IDENTIFICATION
|
||||
* $Header: /cvsroot/pgsql/src/backend/optimizer/util/Attic/keys.c,v 1.4 1997/09/08 02:24:58 momjian Exp $
|
||||
* $Header: /cvsroot/pgsql/src/backend/optimizer/util/Attic/keys.c,v 1.5 1997/09/08 21:45:51 momjian Exp $
|
||||
*
|
||||
*-------------------------------------------------------------------------
|
||||
*/
|
||||
@ -22,8 +22,8 @@
|
||||
#include "optimizer/tlist.h"
|
||||
|
||||
|
||||
static Expr *matching2_tlvar(int var, List * tlist, bool(*test) ());
|
||||
static bool equal_indexkey_var(int index_key, Var * var);
|
||||
static Expr *matching2_tlvar(int var, List *tlist, bool (*test) ());
|
||||
static bool equal_indexkey_var(int index_key, Var *var);
|
||||
|
||||
/*
|
||||
* 1. index key
|
||||
@ -54,7 +54,7 @@ static bool equal_indexkey_var(int index_key, Var * var);
|
||||
*
|
||||
*/
|
||||
bool
|
||||
match_indexkey_operand(int indexkey, Var * operand, Rel * rel)
|
||||
match_indexkey_operand(int indexkey, Var *operand, Rel *rel)
|
||||
{
|
||||
if (IsA(operand, Var) &&
|
||||
(lfirsti(rel->relids) == operand->varno) &&
|
||||
@ -71,7 +71,7 @@ match_indexkey_operand(int indexkey, Var * operand, Rel * rel)
|
||||
*
|
||||
*/
|
||||
static bool
|
||||
equal_indexkey_var(int index_key, Var * var)
|
||||
equal_indexkey_var(int index_key, Var *var)
|
||||
{
|
||||
if (index_key == var->varattno)
|
||||
return (true);
|
||||
@ -86,7 +86,7 @@ equal_indexkey_var(int index_key, Var * var)
|
||||
*
|
||||
*/
|
||||
Var *
|
||||
extract_subkey(JoinKey * jk, int which_subkey)
|
||||
extract_subkey(JoinKey *jk, int which_subkey)
|
||||
{
|
||||
Var *retval;
|
||||
|
||||
@ -118,7 +118,7 @@ extract_subkey(JoinKey * jk, int which_subkey)
|
||||
*
|
||||
*/
|
||||
bool
|
||||
samekeys(List * keys1, List * keys2)
|
||||
samekeys(List *keys1, List *keys2)
|
||||
{
|
||||
bool allmember = true;
|
||||
List *key1,
|
||||
@ -153,7 +153,7 @@ samekeys(List * keys1, List * keys2)
|
||||
* They should be merged.
|
||||
*/
|
||||
static Expr *
|
||||
matching2_tlvar(int var, List * tlist, bool(*test) ())
|
||||
matching2_tlvar(int var, List *tlist, bool (*test) ())
|
||||
{
|
||||
TargetEntry *tlentry = NULL;
|
||||
|
||||
@ -179,7 +179,7 @@ matching2_tlvar(int var, List * tlist, bool(*test) ())
|
||||
|
||||
|
||||
List *
|
||||
collect_index_pathkeys(int *index_keys, List * tlist)
|
||||
collect_index_pathkeys(int *index_keys, List *tlist)
|
||||
{
|
||||
List *retval = NIL;
|
||||
|
||||
|
@ -7,7 +7,7 @@
|
||||
*
|
||||
*
|
||||
* IDENTIFICATION
|
||||
* $Header: /cvsroot/pgsql/src/backend/optimizer/util/Attic/ordering.c,v 1.5 1997/09/08 02:24:58 momjian Exp $
|
||||
* $Header: /cvsroot/pgsql/src/backend/optimizer/util/Attic/ordering.c,v 1.6 1997/09/08 21:45:52 momjian Exp $
|
||||
*
|
||||
*-------------------------------------------------------------------------
|
||||
*/
|
||||
@ -18,7 +18,7 @@
|
||||
#include "optimizer/internal.h"
|
||||
#include "optimizer/ordering.h"
|
||||
|
||||
static bool equal_sortops_order(Oid * ordering1, Oid * ordering2);
|
||||
static bool equal_sortops_order(Oid *ordering1, Oid *ordering2);
|
||||
|
||||
/*
|
||||
* equal-path-path-ordering--
|
||||
@ -26,8 +26,8 @@ static bool equal_sortops_order(Oid * ordering1, Oid * ordering2);
|
||||
*
|
||||
*/
|
||||
bool
|
||||
equal_path_path_ordering(PathOrder * path_ordering1,
|
||||
PathOrder * path_ordering2)
|
||||
equal_path_path_ordering(PathOrder *path_ordering1,
|
||||
PathOrder *path_ordering2)
|
||||
{
|
||||
if (path_ordering1 == path_ordering2)
|
||||
return true;
|
||||
@ -77,8 +77,8 @@ equal_path_path_ordering(PathOrder * path_ordering1,
|
||||
*
|
||||
*/
|
||||
bool
|
||||
equal_path_merge_ordering(Oid * path_ordering,
|
||||
MergeOrder * merge_ordering)
|
||||
equal_path_merge_ordering(Oid *path_ordering,
|
||||
MergeOrder *merge_ordering)
|
||||
{
|
||||
if (path_ordering == NULL || merge_ordering == NULL)
|
||||
return (false);
|
||||
@ -96,8 +96,8 @@ equal_path_merge_ordering(Oid * path_ordering,
|
||||
*
|
||||
*/
|
||||
bool
|
||||
equal_merge_merge_ordering(MergeOrder * merge_ordering1,
|
||||
MergeOrder * merge_ordering2)
|
||||
equal_merge_merge_ordering(MergeOrder *merge_ordering1,
|
||||
MergeOrder *merge_ordering2)
|
||||
{
|
||||
return (equal(merge_ordering1, merge_ordering2));
|
||||
}
|
||||
@ -111,7 +111,7 @@ equal_merge_merge_ordering(MergeOrder * merge_ordering1,
|
||||
* Returns true iff the sort operators are in the same order.
|
||||
*/
|
||||
static bool
|
||||
equal_sortops_order(Oid * ordering1, Oid * ordering2)
|
||||
equal_sortops_order(Oid *ordering1, Oid *ordering2)
|
||||
{
|
||||
int i = 0;
|
||||
|
||||
|
@ -7,7 +7,7 @@
|
||||
*
|
||||
*
|
||||
* IDENTIFICATION
|
||||
* $Header: /cvsroot/pgsql/src/backend/optimizer/util/pathnode.c,v 1.5 1997/09/08 02:24:59 momjian Exp $
|
||||
* $Header: /cvsroot/pgsql/src/backend/optimizer/util/pathnode.c,v 1.6 1997/09/08 21:45:53 momjian Exp $
|
||||
*
|
||||
*-------------------------------------------------------------------------
|
||||
*/
|
||||
@ -29,7 +29,7 @@
|
||||
|
||||
#include "parser/parsetree.h" /* for getrelid() */
|
||||
|
||||
static Path *better_path(Path * new_path, List * unique_paths, bool * noOther);
|
||||
static Path *better_path(Path *new_path, List *unique_paths, bool *noOther);
|
||||
|
||||
|
||||
/*****************************************************************************
|
||||
@ -42,7 +42,7 @@ static Path *better_path(Path * new_path, List * unique_paths, bool * noOther);
|
||||
*
|
||||
*/
|
||||
bool
|
||||
path_is_cheaper(Path * path1, Path * path2)
|
||||
path_is_cheaper(Path *path1, Path *path2)
|
||||
{
|
||||
Cost cost1 = path1->path_cost;
|
||||
Cost cost2 = path2->path_cost;
|
||||
@ -62,7 +62,7 @@ path_is_cheaper(Path * path1, Path * path2)
|
||||
*
|
||||
*/
|
||||
Path *
|
||||
set_cheapest(Rel * parent_rel, List * pathlist)
|
||||
set_cheapest(Rel *parent_rel, List *pathlist)
|
||||
{
|
||||
List *p;
|
||||
Path *cheapest_so_far;
|
||||
@ -101,7 +101,7 @@ set_cheapest(Rel * parent_rel, List * pathlist)
|
||||
*
|
||||
*/
|
||||
List *
|
||||
add_pathlist(Rel * parent_rel, List * unique_paths, List * new_paths)
|
||||
add_pathlist(Rel *parent_rel, List *unique_paths, List *new_paths)
|
||||
{
|
||||
List *x;
|
||||
Path *new_path;
|
||||
@ -154,7 +154,7 @@ add_pathlist(Rel * parent_rel, List * unique_paths, List * new_paths)
|
||||
*
|
||||
*/
|
||||
static Path *
|
||||
better_path(Path * new_path, List * unique_paths, bool * noOther)
|
||||
better_path(Path *new_path, List *unique_paths, bool *noOther)
|
||||
{
|
||||
Path *old_path = (Path *) NULL;
|
||||
Path *path = (Path *) NULL;
|
||||
@ -208,7 +208,7 @@ better_path(Path * new_path, List * unique_paths, bool * noOther)
|
||||
*
|
||||
*/
|
||||
Path *
|
||||
create_seqscan_path(Rel * rel)
|
||||
create_seqscan_path(Rel *rel)
|
||||
{
|
||||
int relid = 0;
|
||||
|
||||
@ -258,10 +258,10 @@ create_seqscan_path(Rel * rel)
|
||||
*
|
||||
*/
|
||||
IndexPath *
|
||||
create_index_path(Query * root,
|
||||
Rel * rel,
|
||||
Rel * index,
|
||||
List * restriction_clauses,
|
||||
create_index_path(Query *root,
|
||||
Rel *rel,
|
||||
Rel *index,
|
||||
List *restriction_clauses,
|
||||
bool is_join_scan)
|
||||
{
|
||||
IndexPath *pathnode = makeNode(IndexPath);
|
||||
@ -418,11 +418,11 @@ create_index_path(Query * root,
|
||||
*
|
||||
*/
|
||||
JoinPath *
|
||||
create_nestloop_path(Rel * joinrel,
|
||||
Rel * outer_rel,
|
||||
Path * outer_path,
|
||||
Path * inner_path,
|
||||
List * keys)
|
||||
create_nestloop_path(Rel *joinrel,
|
||||
Rel *outer_rel,
|
||||
Path *outer_path,
|
||||
Path *inner_path,
|
||||
List *keys)
|
||||
{
|
||||
JoinPath *pathnode = makeNode(JoinPath);
|
||||
|
||||
@ -495,18 +495,18 @@ create_nestloop_path(Rel * joinrel,
|
||||
*
|
||||
*/
|
||||
MergePath *
|
||||
create_mergesort_path(Rel * joinrel,
|
||||
create_mergesort_path(Rel *joinrel,
|
||||
int outersize,
|
||||
int innersize,
|
||||
int outerwidth,
|
||||
int innerwidth,
|
||||
Path * outer_path,
|
||||
Path * inner_path,
|
||||
List * keys,
|
||||
MergeOrder * order,
|
||||
List * mergeclauses,
|
||||
List * outersortkeys,
|
||||
List * innersortkeys)
|
||||
Path *outer_path,
|
||||
Path *inner_path,
|
||||
List *keys,
|
||||
MergeOrder *order,
|
||||
List *mergeclauses,
|
||||
List *outersortkeys,
|
||||
List *innersortkeys)
|
||||
{
|
||||
MergePath *pathnode = makeNode(MergePath);
|
||||
|
||||
@ -561,18 +561,18 @@ create_mergesort_path(Rel * joinrel,
|
||||
*
|
||||
*/
|
||||
HashPath *
|
||||
create_hashjoin_path(Rel * joinrel,
|
||||
create_hashjoin_path(Rel *joinrel,
|
||||
int outersize,
|
||||
int innersize,
|
||||
int outerwidth,
|
||||
int innerwidth,
|
||||
Path * outer_path,
|
||||
Path * inner_path,
|
||||
List * keys,
|
||||
Path *outer_path,
|
||||
Path *inner_path,
|
||||
List *keys,
|
||||
Oid operator,
|
||||
List * hashclauses,
|
||||
List * outerkeys,
|
||||
List * innerkeys)
|
||||
List *hashclauses,
|
||||
List *outerkeys,
|
||||
List *innerkeys)
|
||||
{
|
||||
HashPath *pathnode = makeNode(HashPath);
|
||||
|
||||
|
@ -8,7 +8,7 @@
|
||||
*
|
||||
*
|
||||
* IDENTIFICATION
|
||||
* $Header: /cvsroot/pgsql/src/backend/optimizer/util/plancat.c,v 1.8 1997/09/08 02:25:01 momjian Exp $
|
||||
* $Header: /cvsroot/pgsql/src/backend/optimizer/util/plancat.c,v 1.9 1997/09/08 21:45:53 momjian Exp $
|
||||
*
|
||||
*-------------------------------------------------------------------------
|
||||
*/
|
||||
@ -56,8 +56,8 @@ IndexSelectivity(Oid indexrelid, Oid indrelid, int32 nIndexKeys,
|
||||
* number of tuples
|
||||
*/
|
||||
void
|
||||
relation_info(Query * root, Index relid,
|
||||
bool * hasindex, int *pages, int *tuples)
|
||||
relation_info(Query *root, Index relid,
|
||||
bool *hasindex, int *pages, int *tuples)
|
||||
{
|
||||
HeapTuple relationTuple;
|
||||
Form_pg_class relation;
|
||||
@ -101,7 +101,7 @@ relation_info(Query * root, Index relid,
|
||||
*
|
||||
*/
|
||||
bool
|
||||
index_info(Query * root, bool first, int relid, IdxInfoRetval * info)
|
||||
index_info(Query *root, bool first, int relid, IdxInfoRetval *info)
|
||||
{
|
||||
register i;
|
||||
HeapTuple indexTuple,
|
||||
@ -246,12 +246,12 @@ index_info(Query * root, bool first, int relid, IdxInfoRetval * info)
|
||||
*/
|
||||
void
|
||||
index_selectivity(Oid indid,
|
||||
Oid * classes,
|
||||
List * opnos,
|
||||
Oid *classes,
|
||||
List *opnos,
|
||||
Oid relid,
|
||||
List * attnos,
|
||||
List * values,
|
||||
List * flags,
|
||||
List *attnos,
|
||||
List *values,
|
||||
List *flags,
|
||||
int32 nkeys,
|
||||
float *idxPages,
|
||||
float *idxSelec)
|
||||
@ -355,7 +355,7 @@ restriction_selectivity(Oid functionObjectId,
|
||||
elog(WARN, "RestrictionClauseSelectivity: bad value %lf",
|
||||
*result);
|
||||
|
||||
return ((Cost) * result);
|
||||
return ((Cost) *result);
|
||||
}
|
||||
|
||||
/*
|
||||
@ -394,7 +394,7 @@ join_selectivity(Oid functionObjectId,
|
||||
elog(WARN, "JoinClauseSelectivity: bad value %lf",
|
||||
*result);
|
||||
|
||||
return ((Cost) * result);
|
||||
return ((Cost) *result);
|
||||
}
|
||||
|
||||
/*
|
||||
|
@ -7,7 +7,7 @@
|
||||
*
|
||||
*
|
||||
* IDENTIFICATION
|
||||
* $Header: /cvsroot/pgsql/src/backend/optimizer/util/relnode.c,v 1.3 1997/09/08 02:25:02 momjian Exp $
|
||||
* $Header: /cvsroot/pgsql/src/backend/optimizer/util/relnode.c,v 1.4 1997/09/08 21:45:54 momjian Exp $
|
||||
*
|
||||
*-------------------------------------------------------------------------
|
||||
*/
|
||||
@ -28,7 +28,7 @@
|
||||
*
|
||||
*/
|
||||
Rel *
|
||||
get_base_rel(Query * root, int relid)
|
||||
get_base_rel(Query *root, int relid)
|
||||
{
|
||||
List *relids;
|
||||
Rel *rel;
|
||||
@ -101,7 +101,7 @@ get_base_rel(Query * root, int relid)
|
||||
*
|
||||
*/
|
||||
Rel *
|
||||
get_join_rel(Query * root, List * relid)
|
||||
get_join_rel(Query *root, List *relid)
|
||||
{
|
||||
return rel_member(relid, root->join_relation_list_);
|
||||
}
|
||||
@ -115,7 +115,7 @@ get_join_rel(Query * root, List * relid)
|
||||
*
|
||||
*/
|
||||
Rel *
|
||||
rel_member(List * relid, List * rels)
|
||||
rel_member(List *relid, List *rels)
|
||||
{
|
||||
List *temp = NIL;
|
||||
List *temprelid = NIL;
|
||||
|
@ -7,7 +7,7 @@
|
||||
*
|
||||
*
|
||||
* IDENTIFICATION
|
||||
* $Header: /cvsroot/pgsql/src/backend/optimizer/util/tlist.c,v 1.6 1997/09/08 02:25:03 momjian Exp $
|
||||
* $Header: /cvsroot/pgsql/src/backend/optimizer/util/tlist.c,v 1.7 1997/09/08 21:45:55 momjian Exp $
|
||||
*
|
||||
*-------------------------------------------------------------------------
|
||||
*/
|
||||
@ -28,7 +28,7 @@
|
||||
#include "nodes/makefuncs.h"
|
||||
#include "parser/catalog_utils.h"
|
||||
|
||||
static Node *flatten_tlistentry(Node * tlistentry, List * flat_tlist);
|
||||
static Node *flatten_tlistentry(Node *tlistentry, List *flat_tlist);
|
||||
|
||||
/*****************************************************************************
|
||||
* ---------- RELATION node target list routines ----------
|
||||
@ -45,7 +45,7 @@ static Node *flatten_tlistentry(Node * tlistentry, List * flat_tlist);
|
||||
* targetlist = valid sequence
|
||||
*/
|
||||
TargetEntry *
|
||||
tlistentry_member(Var * var, List * targetlist)
|
||||
tlistentry_member(Var *var, List *targetlist)
|
||||
{
|
||||
if (var)
|
||||
{
|
||||
@ -70,7 +70,7 @@ tlistentry_member(Var * var, List * targetlist)
|
||||
*
|
||||
*/
|
||||
Expr *
|
||||
matching_tlvar(Var * var, List * targetlist)
|
||||
matching_tlvar(Var *var, List *targetlist)
|
||||
{
|
||||
TargetEntry *tlentry;
|
||||
|
||||
@ -94,7 +94,7 @@ matching_tlvar(Var * var, List * targetlist)
|
||||
* CREATES: new var-node iff no matching var-node exists in targetlist
|
||||
*/
|
||||
void
|
||||
add_tl_element(Rel * rel, Var * var)
|
||||
add_tl_element(Rel *rel, Var *var)
|
||||
{
|
||||
Expr *oldvar = (Expr *) NULL;
|
||||
|
||||
@ -130,7 +130,7 @@ add_tl_element(Rel * rel, Var * var)
|
||||
* CREATES: new targetlist entry (always).
|
||||
*/
|
||||
TargetEntry *
|
||||
create_tl_element(Var * var, int resdomno)
|
||||
create_tl_element(Var *var, int resdomno)
|
||||
{
|
||||
TargetEntry *tlelement = makeNode(TargetEntry);
|
||||
|
||||
@ -153,7 +153,7 @@ create_tl_element(Var * var, int resdomno)
|
||||
*
|
||||
*/
|
||||
List *
|
||||
get_actual_tlist(List * tlist)
|
||||
get_actual_tlist(List *tlist)
|
||||
{
|
||||
|
||||
/*
|
||||
@ -200,7 +200,7 @@ get_actual_tlist(List * tlist)
|
||||
*
|
||||
*/
|
||||
Resdom *
|
||||
tlist_member(Var * var, List * tlist)
|
||||
tlist_member(Var *var, List *tlist)
|
||||
{
|
||||
List *i = NIL;
|
||||
TargetEntry *temp_tle = (TargetEntry *) NULL;
|
||||
@ -230,7 +230,7 @@ tlist_member(Var * var, List * tlist)
|
||||
* Routine to get the resdom out of a targetlist.
|
||||
*/
|
||||
Resdom *
|
||||
tlist_resdom(List * tlist, Resdom * resnode)
|
||||
tlist_resdom(List *tlist, Resdom *resnode)
|
||||
{
|
||||
Resdom *resdom = (Resdom *) NULL;
|
||||
List *i = NIL;
|
||||
@ -265,7 +265,7 @@ tlist_resdom(List * tlist, Resdom * resnode)
|
||||
* varoattno. Also, nested attnos are long gone. - ay 2/95]
|
||||
*/
|
||||
TargetEntry *
|
||||
match_varid(Var * test_var, List * tlist)
|
||||
match_varid(Var *test_var, List *tlist)
|
||||
{
|
||||
List *tl;
|
||||
Oid type_var;
|
||||
@ -311,7 +311,7 @@ match_varid(Var * test_var, List * tlist)
|
||||
*
|
||||
*/
|
||||
List *
|
||||
new_unsorted_tlist(List * targetlist)
|
||||
new_unsorted_tlist(List *targetlist)
|
||||
{
|
||||
List *new_targetlist = (List *) copyObject((Node *) targetlist);
|
||||
List *x = NIL;
|
||||
@ -339,7 +339,7 @@ new_unsorted_tlist(List * targetlist)
|
||||
*
|
||||
*/
|
||||
List *
|
||||
copy_vars(List * target, List * source)
|
||||
copy_vars(List *target, List *source)
|
||||
{
|
||||
List *result = NIL;
|
||||
List *src = NIL;
|
||||
@ -367,7 +367,7 @@ copy_vars(List * target, List * source)
|
||||
*
|
||||
*/
|
||||
List *
|
||||
flatten_tlist(List * tlist)
|
||||
flatten_tlist(List *tlist)
|
||||
{
|
||||
int last_resdomno = 1;
|
||||
List *new_tlist = NIL;
|
||||
@ -423,7 +423,7 @@ flatten_tlist(List * tlist)
|
||||
*
|
||||
*/
|
||||
List *
|
||||
flatten_tlist_vars(List * full_tlist, List * flat_tlist)
|
||||
flatten_tlist_vars(List *full_tlist, List *flat_tlist)
|
||||
{
|
||||
List *x = NIL;
|
||||
List *result = NIL;
|
||||
@ -454,7 +454,7 @@ flatten_tlist_vars(List * full_tlist, List * flat_tlist)
|
||||
*
|
||||
*/
|
||||
static Node *
|
||||
flatten_tlistentry(Node * tlistentry, List * flat_tlist)
|
||||
flatten_tlistentry(Node *tlistentry, List *flat_tlist)
|
||||
{
|
||||
if (tlistentry == NULL)
|
||||
{
|
||||
@ -544,7 +544,7 @@ flatten_tlistentry(Node * tlistentry, List * flat_tlist)
|
||||
|
||||
|
||||
TargetEntry *
|
||||
MakeTLE(Resdom * resdom, Node * expr)
|
||||
MakeTLE(Resdom *resdom, Node *expr)
|
||||
{
|
||||
TargetEntry *rt = makeNode(TargetEntry);
|
||||
|
||||
@ -554,7 +554,7 @@ MakeTLE(Resdom * resdom, Node * expr)
|
||||
}
|
||||
|
||||
Var *
|
||||
get_expr(TargetEntry * tle)
|
||||
get_expr(TargetEntry *tle)
|
||||
{
|
||||
Assert(tle != NULL);
|
||||
Assert(tle->expr != NULL);
|
||||
@ -574,7 +574,7 @@ get_expr(TargetEntry * tle)
|
||||
*/
|
||||
#ifdef NOT_USED
|
||||
void
|
||||
AddGroupAttrToTlist(List * tlist, List * grpCl)
|
||||
AddGroupAttrToTlist(List *tlist, List *grpCl)
|
||||
{
|
||||
List *gl;
|
||||
int last_resdomno = length(tlist) + 1;
|
||||
@ -606,7 +606,7 @@ AddGroupAttrToTlist(List * tlist, List * grpCl)
|
||||
/* was ExecTargetListLength() in execQual.c,
|
||||
moved here to reduce dependencies on the executor module */
|
||||
int
|
||||
exec_tlist_length(List * targetlist)
|
||||
exec_tlist_length(List *targetlist)
|
||||
{
|
||||
int len;
|
||||
List *tl;
|
||||
|
@ -7,7 +7,7 @@
|
||||
*
|
||||
*
|
||||
* IDENTIFICATION
|
||||
* $Header: /cvsroot/pgsql/src/backend/optimizer/util/var.c,v 1.5 1997/09/08 02:25:07 momjian Exp $
|
||||
* $Header: /cvsroot/pgsql/src/backend/optimizer/util/var.c,v 1.6 1997/09/08 21:45:56 momjian Exp $
|
||||
*
|
||||
*-------------------------------------------------------------------------
|
||||
*/
|
||||
@ -35,7 +35,7 @@
|
||||
* (though it currently is, see primnodes.h)
|
||||
*/
|
||||
List *
|
||||
pull_varnos(Node * me)
|
||||
pull_varnos(Node *me)
|
||||
{
|
||||
List *i,
|
||||
*result = NIL;
|
||||
@ -75,7 +75,7 @@ pull_varnos(Node * me)
|
||||
* Returns true if any varnode found.
|
||||
*/
|
||||
bool
|
||||
contain_var_clause(Node * clause)
|
||||
contain_var_clause(Node *clause)
|
||||
{
|
||||
if (clause == NULL)
|
||||
return FALSE;
|
||||
@ -144,7 +144,7 @@ contain_var_clause(Node * clause)
|
||||
* Returns list of varnodes found.
|
||||
*/
|
||||
List *
|
||||
pull_var_clause(Node * clause)
|
||||
pull_var_clause(Node *clause)
|
||||
{
|
||||
List *retval = NIL;
|
||||
|
||||
@ -204,9 +204,9 @@ pull_var_clause(Node * clause)
|
||||
* Returns t iff two var nodes correspond to the same attribute.
|
||||
*/
|
||||
bool
|
||||
var_equal(Var * var1, Var * var2)
|
||||
var_equal(Var *var1, Var *var2)
|
||||
{
|
||||
if (IsA(var1, Var) && IsA(var2, Var) &&
|
||||
if (IsA(var1, Var) &&IsA(var2, Var) &&
|
||||
(((Var *) var1)->varno == ((Var *) var2)->varno) &&
|
||||
(((Var *) var1)->vartype == ((Var *) var2)->vartype) &&
|
||||
(((Var *) var1)->varattno == ((Var *) var2)->varattno))
|
||||
|
Reference in New Issue
Block a user