OSDN Git Service

3eec90c9423c58d94081461e54c8ee1ec59ad347
[pg-rex/syncrep.git] / src / include / utils / selfuncs.h
1 /*-------------------------------------------------------------------------
2  *
3  * selfuncs.h
4  *        Selectivity functions and index cost estimation functions for
5  *        standard operators and index access methods.
6  *
7  *
8  * Portions Copyright (c) 1996-2002, PostgreSQL Global Development Group
9  * Portions Copyright (c) 1994, Regents of the University of California
10  *
11  * $Id: selfuncs.h,v 1.14 2003/08/04 00:43:32 momjian Exp $
12  *
13  *-------------------------------------------------------------------------
14  */
15 #ifndef SELFUNCS_H
16 #define SELFUNCS_H
17
18 #include "fmgr.h"
19 #include "nodes/parsenodes.h"
20
21
22 typedef enum
23 {
24         Pattern_Type_Like, Pattern_Type_Like_IC,
25         Pattern_Type_Regex, Pattern_Type_Regex_IC
26 } Pattern_Type;
27
28 typedef enum
29 {
30         Pattern_Prefix_None, Pattern_Prefix_Partial, Pattern_Prefix_Exact
31 } Pattern_Prefix_Status;
32
33
34 /* selfuncs.c */
35
36 extern Pattern_Prefix_Status pattern_fixed_prefix(Const *patt,
37                                          Pattern_Type ptype,
38                                          Const **prefix,
39                                          Const **rest);
40 extern Const *make_greater_string(const Const *str_const);
41
42 extern Datum eqsel(PG_FUNCTION_ARGS);
43 extern Datum neqsel(PG_FUNCTION_ARGS);
44 extern Datum scalarltsel(PG_FUNCTION_ARGS);
45 extern Datum scalargtsel(PG_FUNCTION_ARGS);
46 extern Datum regexeqsel(PG_FUNCTION_ARGS);
47 extern Datum icregexeqsel(PG_FUNCTION_ARGS);
48 extern Datum likesel(PG_FUNCTION_ARGS);
49 extern Datum iclikesel(PG_FUNCTION_ARGS);
50 extern Datum regexnesel(PG_FUNCTION_ARGS);
51 extern Datum icregexnesel(PG_FUNCTION_ARGS);
52 extern Datum nlikesel(PG_FUNCTION_ARGS);
53 extern Datum icnlikesel(PG_FUNCTION_ARGS);
54
55 extern Datum eqjoinsel(PG_FUNCTION_ARGS);
56 extern Datum neqjoinsel(PG_FUNCTION_ARGS);
57 extern Datum scalarltjoinsel(PG_FUNCTION_ARGS);
58 extern Datum scalargtjoinsel(PG_FUNCTION_ARGS);
59 extern Datum regexeqjoinsel(PG_FUNCTION_ARGS);
60 extern Datum icregexeqjoinsel(PG_FUNCTION_ARGS);
61 extern Datum likejoinsel(PG_FUNCTION_ARGS);
62 extern Datum iclikejoinsel(PG_FUNCTION_ARGS);
63 extern Datum regexnejoinsel(PG_FUNCTION_ARGS);
64 extern Datum icregexnejoinsel(PG_FUNCTION_ARGS);
65 extern Datum nlikejoinsel(PG_FUNCTION_ARGS);
66 extern Datum icnlikejoinsel(PG_FUNCTION_ARGS);
67
68 extern Selectivity booltestsel(Query *root, BoolTestType booltesttype,
69                         Node *arg, int varRelid, JoinType jointype);
70 extern Selectivity nulltestsel(Query *root, NullTestType nulltesttype,
71                         Node *arg, int varRelid);
72
73 extern void mergejoinscansel(Query *root, Node *clause,
74                                  Selectivity *leftscan,
75                                  Selectivity *rightscan);
76
77 extern double estimate_num_groups(Query *root, List *groupExprs,
78                                         double input_rows);
79
80 extern Datum btcostestimate(PG_FUNCTION_ARGS);
81 extern Datum rtcostestimate(PG_FUNCTION_ARGS);
82 extern Datum hashcostestimate(PG_FUNCTION_ARGS);
83 extern Datum gistcostestimate(PG_FUNCTION_ARGS);
84
85 #endif   /* SELFUNCS_H */