aboutsummaryrefslogtreecommitdiff
path: root/src/backend/utils/cache/rel.c
blob: 33eabad1a8524e1550e5abab139b95555d600b1b (plain)
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
69
70
71
72
73
74
75
76
77
/*-------------------------------------------------------------------------
 *
 * rel.c--
 *    POSTGRES relation descriptor code.
 *
 * Copyright (c) 1994, Regents of the University of California
 *
 *
 * IDENTIFICATION
 *    $Header: /cvsroot/pgsql/src/backend/utils/cache/Attic/rel.c,v 1.1.1.1 1996/07/09 06:22:06 scrappy Exp $
 *
 *-------------------------------------------------------------------------
 */
/* #define RELREFDEBUG	1 */

#include "postgres.h"
#include "miscadmin.h"
#include "access/istrat.h"
#include "access/tupdesc.h"
#include "utils/rel.h"
#include "storage/fd.h"


/* 
 *	RelationIsValid is now a macro in rel.h -cim 4/27/91
 *
 *      Many of the RelationGet...() functions are now macros in rel.h
 *		-mer 3/2/92
 */

/*
 * RelationGetIndexStrategy --
 *	Returns index strategy for a relation.
 *
 * Note:
 *	Assumes relation descriptor is valid.
 *	Assumes relation descriptor is for an index relation.
 */
IndexStrategy
RelationGetIndexStrategy(Relation relation)
{
  return relation->rd_istrat;
}

/*
 * RelationSetIndexSupport --
 *	Sets index strategy and support info for a relation.
 *
 * Note:
 *	Assumes relation descriptor is a valid pointer to sufficient space.
 *	Assumes index strategy is valid.  Assumes support is valid if non-
 *	NULL.
 */
/* ----------------
 *	RelationSetIndexSupport
 *
 *	This routine saves two pointers -- one to the IndexStrategy, and
 *	one to the RegProcs that support the indexed access method.  These
 *	pointers are stored in the space following the attribute data in the
 *	reldesc.
 *
 *   NEW:  the index strategy and support are now stored in real fields
 *         at the end of the structure                    - jolly
 * ----------------
 */
void
RelationSetIndexSupport(Relation relation,
			IndexStrategy strategy,
			RegProcedure *support)
{
    Assert(PointerIsValid(relation));
    Assert(IndexStrategyIsValid(strategy));
    
    relation->rd_istrat = strategy;
    relation->rd_support = support;
}