22 * Routines for handling of 'SET var TO',
33 *'SHOW var' and 'RESET var' statements.
44 *
5- * $Id: variable.c,v 1.27 2000/01/15 02:59:29 petere Exp $
5+ * $Id: variable.c,v 1.28 2000/01/22 23:50:10 tgl Exp $
66 *
77 */
88
1414#include "catalog/pg_shadow.h"
1515#include "commands/variable.h"
1616#include "miscadmin.h"
17- #include "optimizer/internal.h"
17+ #include "optimizer/cost.h"
18+ #include "optimizer/paths.h"
1819#include "utils/builtins.h"
1920#include "utils/tqual.h"
2021#include "utils/trace.h"
@@ -45,10 +46,6 @@ static bool show_XactIsoLevel(void);
4546static bool reset_XactIsoLevel (void );
4647static bool parse_XactIsoLevel (const char * );
4748
48- extern Cost _cpu_page_weight_ ;
49- extern Cost _cpu_index_page_weight_ ;
50- extern bool _use_geqo_ ;
51- extern int32 _use_geqo_rels_ ;
5249extern bool _use_keyset_query_optimizer ;
5350
5451/*
@@ -183,23 +180,23 @@ parse_geqo(const char *value)
183180
184181if (strcasecmp (tok ,"on" )== 0 )
185182{
186- int32 geqo_rels = GEQO_RELS ;
183+ int new_geqo_rels = GEQO_RELS ;
187184
188185if (val != NULL )
189186{
190- geqo_rels = pg_atoi (val ,sizeof (int32 ),'\0' );
191- if (geqo_rels <=1 )
187+ new_geqo_rels = pg_atoi (val ,sizeof (int ),'\0' );
188+ if (new_geqo_rels <=1 )
192189elog (ERROR ,"Bad value for # of relations (%s)" ,val );
193190pfree (val );
194191}
195- _use_geqo_ = true;
196- _use_geqo_rels_ = geqo_rels ;
192+ enable_geqo = true;
193+ geqo_rels = new_geqo_rels ;
197194}
198195else if (strcasecmp (tok ,"off" )== 0 )
199196{
200197if ((val != NULL )&& (* val != '\0' ))
201198elog (ERROR ,"%s does not allow a parameter" ,tok );
202- _use_geqo_ = false;
199+ enable_geqo = false;
203200}
204201else
205202elog (ERROR ,"Bad value for GEQO (%s)" ,value );
@@ -212,8 +209,8 @@ static bool
212209show_geqo ()
213210{
214211
215- if (_use_geqo_ )
216- elog (NOTICE ,"GEQO is ON beginning with %d relations" ,_use_geqo_rels_ );
212+ if (enable_geqo )
213+ elog (NOTICE ,"GEQO is ON beginning with %d relations" ,geqo_rels );
217214else
218215elog (NOTICE ,"GEQO is OFF" );
219216return TRUE;
@@ -224,11 +221,11 @@ reset_geqo(void)
224221{
225222
226223#ifdef GEQO
227- _use_geqo_ = true;
224+ enable_geqo = true;
228225#else
229- _use_geqo_ = false;
226+ enable_geqo = false;
230227#endif
231- _use_geqo_rels_ = GEQO_RELS ;
228+ geqo_rels = GEQO_RELS ;
232229return TRUE;
233230}
234231
@@ -240,16 +237,16 @@ reset_geqo(void)
240237static bool
241238parse_cost_heap (const char * value )
242239{
243- float32 res ;
240+ float64 res ;
244241
245242if (value == NULL )
246243{
247244reset_cost_heap ();
248245return TRUE;
249246}
250247
251- res = float4in ((char * )value );
252- _cpu_page_weight_ = * res ;
248+ res = float8in ((char * )value );
249+ cpu_page_weight = * res ;
253250
254251return TRUE;
255252}
@@ -258,14 +255,14 @@ static bool
258255show_cost_heap ()
259256{
260257
261- elog (NOTICE ,"COST_HEAP is %f" ,_cpu_page_weight_ );
258+ elog (NOTICE ,"COST_HEAP is %f" ,cpu_page_weight );
262259return TRUE;
263260}
264261
265262static bool
266263reset_cost_heap ()
267264{
268- _cpu_page_weight_ = _CPU_PAGE_WEIGHT_ ;
265+ cpu_page_weight = CPU_PAGE_WEIGHT ;
269266return TRUE;
270267}
271268
@@ -277,16 +274,16 @@ reset_cost_heap()
277274static bool
278275parse_cost_index (const char * value )
279276{
280- float32 res ;
277+ float64 res ;
281278
282279if (value == NULL )
283280{
284281reset_cost_index ();
285282return TRUE;
286283}
287284
288- res = float4in ((char * )value );
289- _cpu_index_page_weight_ = * res ;
285+ res = float8in ((char * )value );
286+ cpu_index_page_weight = * res ;
290287
291288return TRUE;
292289}
@@ -295,14 +292,14 @@ static bool
295292show_cost_index ()
296293{
297294
298- elog (NOTICE ,"COST_INDEX is %f" ,_cpu_index_page_weight_ );
295+ elog (NOTICE ,"COST_INDEX is %f" ,cpu_index_page_weight );
299296return TRUE;
300297}
301298
302299static bool
303300reset_cost_index ()
304301{
305- _cpu_index_page_weight_ = _CPU_INDEX_PAGE_WEIGHT_ ;
302+ cpu_index_page_weight = CPU_INDEX_PAGE_WEIGHT ;
306303return TRUE;
307304}
308305