Skip to content

Commit c4ab256

Browse files
committed
New VAR r_plans added to enable turn ON/OFF
using right-sided plans.
1 parent 0f67fb4 commit c4ab256

File tree

1 file changed

+37
-1
lines changed

1 file changed

+37
-1
lines changed

src/backend/tcop/variable.c

Lines changed: 37 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -2,7 +2,7 @@
22
* Routines for handling of 'SET var TO', 'SHOW var' and 'RESET var'
33
* statements.
44
*
5-
* $Id: variable.c,v 1.8 1997/05/16 07:24:13 thomas Exp $
5+
* $Id: variable.c,v 1.9 1997/05/20 10:31:42 vadim Exp $
66
*
77
*/
88

@@ -17,6 +17,7 @@
1717
extern Cost _cpu_page_wight_;
1818
extern Cost _cpu_index_page_wight_;
1919
extern bool _use_geqo_;
20+
extern bool _use_right_sided_plans_;
2021

2122
/*-----------------------------------------------------------------------*/
2223
#if USE_EURODATES
@@ -104,6 +105,40 @@ static bool reset_geqo ()
104105
return TRUE;
105106
}
106107

108+
static bool parse_r_plans (const char *value)
109+
{
110+
111+
if ( strcasecmp (value, "on") == 0 )
112+
_use_right_sided_plans_ = true;
113+
else if ( strcasecmp (value, "off") == 0 )
114+
_use_right_sided_plans_ = false;
115+
else
116+
elog(WARN, "Bad value for Right-sided Plans (%s)", value);
117+
118+
return TRUE;
119+
}
120+
121+
static bool show_r_plans ()
122+
{
123+
124+
if ( _use_right_sided_plans_ )
125+
elog (NOTICE, "Right-sided Plans are ON");
126+
else
127+
elog (NOTICE, "Right-sided Plans are OFF");
128+
return TRUE;
129+
}
130+
131+
static bool reset_r_plans ()
132+
{
133+
134+
#ifdef USE_RIGHT_SIDED_PLANS
135+
_use_right_sided_plans_ = true;
136+
#else
137+
_use_right_sided_plans_ = false;
138+
#endif
139+
return TRUE;
140+
}
141+
107142
static bool parse_cost_heap (const char *value)
108143
{
109144
float32 res = float4in ((char*)value);
@@ -250,6 +285,7 @@ struct VariableParsers
250285
{ "cost_index", parse_cost_index,
251286
show_cost_index, reset_cost_index },
252287
{ "geqo", parse_geqo, show_geqo, reset_geqo },
288+
{ "r_plans", parse_r_plans, show_r_plans, reset_r_plans },
253289
{ NULL, NULL, NULL }
254290
};
255291

0 commit comments

Comments
 (0)