summaryrefslogtreecommitdiff
path: root/src/backend/utils/adt/geo_selfuncs.c
blob: 9d011cdbb206164332b6f9c7cc811969ded26ea6 (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
78
79
80
81
82
83
84
85
86
87
88
89
90
91
92
93
94
95
96
97
98
99
100
101
102
103
104
105
106
107
108
109
110
111
112
113
114
115
116
117
118
119
120
121
122
123
124
125
126
127
128
129
130
131
132
133
134
135
136
137
/*-------------------------------------------------------------------------
 *
 * geo-selfuncs.c--
 *	  Selectivity routines registered in the operator catalog in the
 *	  "oprrest" and "oprjoin" attributes.
 *
 * Copyright (c) 1994, Regents of the University of California
 *
 *
 * IDENTIFICATION
 *	  $Header: /cvsroot/pgsql/src/backend/utils/adt/geo_selfuncs.c,v 1.6 1998/09/01 03:26:02 momjian Exp $
 *
 *		XXX These are totally bogus.
 *
 *-------------------------------------------------------------------------
 */
#include "postgres.h"

#include "access/attnum.h"
#include "utils/geo_decls.h"	/* where function declarations go */
#include "utils/palloc.h"
#include "utils/builtins.h"

float64
areasel(Oid opid,
		Oid relid,
		AttrNumber attno,
		char *value,
		int32 flag)
{
	float64		result;

	result = (float64) palloc(sizeof(float64data));
	*result = 1.0 / 4.0;
	return result;
}

float64
areajoinsel(Oid opid,
			Oid relid,
			AttrNumber attno,
			char *value,
			int32 flag)
{
	float64		result;

	result = (float64) palloc(sizeof(float64data));
	*result = 1.0 / 4.0;
	return result;
}

/*
 *	Selectivity functions for rtrees.  These are bogus -- unless we know
 *	the actual key distribution in the index, we can't make a good prediction
 *	of the selectivity of these operators.
 *
 *	In general, rtrees need to search multiple subtrees in order to guarantee
 *	that all occurrences of the same key have been found.  Because of this,
 *	the heuristic selectivity functions we return are higher than they would
 *	otherwise be.
 */

/*
 *	left_sel -- How likely is a box to be strictly left of (right of, above,
 *				below) a given box?
 */

#ifdef NOT_USED
float64
leftsel(Oid opid,
		Oid relid,
		AttrNumber attno,
		char *value,
		int32 flag)
{
	float64		result;

	result = (float64) palloc(sizeof(float64data));
	*result = 1.0 / 6.0;
	return result;
}

#endif

#ifdef NOT_USED
float64
leftjoinsel(Oid opid,
			Oid relid,
			AttrNumber attno,
			char *value,
			int32 flag)
{
	float64		result;

	result = (float64) palloc(sizeof(float64data));
	*result = 1.0 / 6.0;
	return result;
}

#endif

/*
 *	contsel -- How likely is a box to contain (be contained by) a given box?
 */
#ifdef NOT_USED
float64
contsel(Oid opid,
		Oid relid,
		AttrNumber attno,
		char *value,
		int32 flag)
{
	float64		result;

	result = (float64) palloc(sizeof(float64data));
	*result = 1.0 / 10.0;
	return result;
}

#endif

#ifdef NOT_USED
float64
contjoinsel(Oid opid,
			Oid relid,
			AttrNumber attno,
			char *value,
			int32 flag)
{
	float64		result;

	result = (float64) palloc(sizeof(float64data));
	*result = 1.0 / 10.0;
	return result;
}

#endif