diff options
author | Tom Lane <tgl@sss.pgh.pa.us> | 1999-11-21 23:25:47 +0000 |
---|---|---|
committer | Tom Lane <tgl@sss.pgh.pa.us> | 1999-11-21 23:25:47 +0000 |
commit | 610dfa6d5560ebcd72ecca82c64c91503efc9bc5 (patch) | |
tree | 79b676d6133877f8e790e5324005666c92e96b00 /src/include | |
parent | 40d3e9254101d23c4f70b95d621277d306c7baf1 (diff) |
Combine index_info and find_secondary_indexes into a single routine that
returns a list of RelOptInfos, eliminating the need for static state
in index_info. That static state was a direct cause of coredumps; if
anything decided to elog(ERROR) partway through an index_info search of
pg_index, the next query would try to close a scan pointer that was
pointing at no-longer-valid memory. Another example of the reasons to
avoid static state variables...
Diffstat (limited to 'src/include')
-rw-r--r-- | src/include/optimizer/plancat.h | 33 |
1 files changed, 6 insertions, 27 deletions
diff --git a/src/include/optimizer/plancat.h b/src/include/optimizer/plancat.h index 9a12ecb1d8c..34c853d68f8 100644 --- a/src/include/optimizer/plancat.h +++ b/src/include/optimizer/plancat.h @@ -6,7 +6,7 @@ * * Copyright (c) 1994, Regents of the University of California * - * $Id: plancat.h,v 1.13 1999/07/25 23:07:23 tgl Exp $ + * $Id: plancat.h,v 1.14 1999/11/21 23:25:42 tgl Exp $ * *------------------------------------------------------------------------- */ @@ -15,32 +15,11 @@ #include "nodes/parsenodes.h" -/* - * transient data structure to hold return value of index_info. Note that - * indexkeys, orderOprs and classlist is "null-terminated". - */ -typedef struct IdxInfoRetval -{ - Oid relid; /* OID of the index relation (not the OID - * of the relation being indexed) */ - Oid relam; /* OID of the pg_am of this index */ - int pages; /* number of pages in the index relation */ - int tuples; /* number of tuples in the index relation */ - int *indexkeys; /* keys over which we're indexing */ - Oid *orderOprs; /* operators used for ordering purposes */ - Oid *classlist; /* classes of AM operators */ - Oid indproc; - Node *indpred; -} IdxInfoRetval; - - -extern void relation_info(Query *root, - Oid relid, - bool *hashindex, int *pages, - int *tuples); - -extern bool index_info(Query *root, - bool first, int relid, IdxInfoRetval *info); + +extern void relation_info(Query *root, Index relid, + bool *hasindex, int *pages, int *tuples); + +extern List *find_secondary_indexes(Query *root, Index relid); extern Cost restriction_selectivity(Oid functionObjectId, Oid operatorObjectId, |