Tom Lane 610dfa6d55 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...
1999-11-21 23:25:47 +00:00

34 lines
837 B
C

/*-------------------------------------------------------------------------
*
* indexnode.c
* Routines to find all indices on a relation
*
* Copyright (c) 1994, Regents of the University of California
*
*
* IDENTIFICATION
* $Header: /cvsroot/pgsql/src/backend/optimizer/util/Attic/indexnode.c,v 1.21 1999/11/21 23:25:47 tgl Exp $
*
*-------------------------------------------------------------------------
*/
#include "postgres.h"
#include "optimizer/pathnode.h"
#include "optimizer/plancat.h"
/*
* find_relation_indices
* Returns a list of index nodes containing appropriate information for
* each (secondary) index defined on a relation.
*
*/
List *
find_relation_indices(Query *root, RelOptInfo *rel)
{
if (rel->indexed)
return find_secondary_indexes(root, lfirsti(rel->relids));
else
return NIL;
}