88 *
99 *
1010 * IDENTIFICATION
11- * $Header: /cvsroot/pgsql/src/backend/tcop/postgres.c,v 1.221 2001/06/18 23:42:32 momjian Exp $
11+ * $Header: /cvsroot/pgsql/src/backend/tcop/postgres.c,v 1.222 2001/06/19 23:40:10 momjian Exp $
1212 *
1313 * NOTES
1414 * this is the "main" module of the postgres backend and
@@ -1108,8 +1108,6 @@ PostgresMain(int argc, char *argv[], int real_argc, char *real_argv[], const cha
11081108 const char * DBName = NULL ;
11091109 bool secure = true;
11101110 int errs = 0 ;
1111- GucContext ctx ;
1112- char * tmp ;
11131111
11141112 int firstchar ;
11151113 StringInfo parser_input ;
@@ -1119,9 +1117,6 @@ PostgresMain(int argc, char *argv[], int real_argc, char *real_argv[], const cha
11191117
11201118 char * potential_DataDir = NULL ;
11211119
1122- /* all options are allowed if not under postmaster */
1123- ctx = IsUnderPostmaster ? PGC_BACKEND : PGC_POSTMASTER ;
1124-
11251120 /*
11261121 * Catch standard options before doing much else. This even works on
11271122 * systems without getopt_long.
@@ -1193,7 +1188,7 @@ PostgresMain(int argc, char *argv[], int real_argc, char *real_argv[], const cha
11931188 {
11941189 case 'A' :
11951190#ifdef USE_ASSERT_CHECKING
1196- SetConfigOption ( "debug_assertions" , optarg , ctx , true );
1191+ assert_enabled = atoi ( optarg );
11971192#else
11981193 fprintf (stderr , "Assert checking is not compiled in\n" );
11991194#endif
@@ -1205,7 +1200,7 @@ PostgresMain(int argc, char *argv[], int real_argc, char *real_argv[], const cha
12051200 * specify the size of buffer pool
12061201 */
12071202 if (secure )
1208- SetConfigOption ( "shared_buffers" , optarg , ctx , true );
1203+ NBuffers = atoi ( optarg );
12091204 break ;
12101205
12111206 case 'C' :
@@ -1222,18 +1217,17 @@ PostgresMain(int argc, char *argv[], int real_argc, char *real_argv[], const cha
12221217 break ;
12231218
12241219 case 'd' : /* debug level */
1225- tmp = "true" ;
1226- SetConfigOption ("debug_level" , optarg , ctx , true);
1220+ DebugLvl = atoi (optarg );
12271221 if (DebugLvl >= 1 );
1228- SetConfigOption ( "log_connections" , tmp , ctx , true) ;
1222+ Log_connections = true;
12291223 if (DebugLvl >= 2 )
1230- SetConfigOption ( "debug_print_query" , tmp , ctx , true) ;
1224+ Debug_print_query = true;
12311225 if (DebugLvl >= 3 )
1232- SetConfigOption ( "debug_print_parse" , tmp , ctx , true) ;
1226+ Debug_print_parse = true;
12331227 if (DebugLvl >= 4 )
1234- SetConfigOption ( "debug_print_plan" , tmp , ctx , true) ;
1228+ Debug_print_plan = true;
12351229 if (DebugLvl >= 5 )
1236- SetConfigOption ( "debug_print_rewritten" , tmp , ctx , true) ;
1230+ Debug_print_rewritten = true;
12371231 break ;
12381232
12391233 case 'E' :
@@ -1258,40 +1252,37 @@ PostgresMain(int argc, char *argv[], int real_argc, char *real_argv[], const cha
12581252 * turn off fsync
12591253 */
12601254 if (secure )
1261- SetConfigOption ( "fsync" , "true" , ctx , true) ;
1255+ enableFsync = false ;
12621256 break ;
12631257
12641258 case 'f' :
12651259
12661260 /*
12671261 * f - forbid generation of certain plans
12681262 */
1269- tmp = NULL ;
12701263 switch (optarg [0 ])
12711264 {
12721265 case 's' : /* seqscan */
1273- tmp = "enable_seqscan" ;
1266+ enable_seqscan = false ;
12741267 break ;
12751268 case 'i' : /* indexscan */
1276- tmp = "enable_indexscan" ;
1269+ enable_indexscan = false ;
12771270 break ;
12781271 case 't' : /* tidscan */
1279- tmp = "enable_tidscan" ;
1272+ enable_tidscan = false ;
12801273 break ;
12811274 case 'n' : /* nestloop */
1282- tmp = "enable_nestloop" ;
1275+ enable_nestloop = false ;
12831276 break ;
12841277 case 'm' : /* mergejoin */
1285- tmp = "enable_mergejoin" ;
1278+ enable_mergejoin = false ;
12861279 break ;
12871280 case 'h' : /* hashjoin */
1288- tmp = "enable_hashjoin" ;
1281+ enable_hashjoin = false ;
12891282 break ;
12901283 default :
12911284 errs ++ ;
12921285 }
1293- if (tmp )
1294- SetConfigOption (tmp , "false" , ctx , true);
12951286 break ;
12961287
12971288 case 'i' :
@@ -1361,15 +1352,21 @@ PostgresMain(int argc, char *argv[], int real_argc, char *real_argv[], const cha
13611352 /*
13621353 * S - amount of sort memory to use in 1k bytes
13631354 */
1364- SetConfigOption ("sort_mem" , optarg , ctx , true);
1355+ {
1356+ int S ;
1357+
1358+ S = atoi (optarg );
1359+ if (S >= 4 * BLCKSZ / 1024 )
1360+ SortMem = S ;
1361+ }
13651362 break ;
13661363
13671364 case 's' :
13681365
13691366 /*
13701367 * s - report usage statistics (timings) after each query
13711368 */
1372- SetConfigOption ( "show_query_stats" , optarg , ctx , true) ;
1369+ Show_query_stats = 1 ;
13731370 break ;
13741371
13751372 case 't' :
@@ -1383,26 +1380,23 @@ PostgresMain(int argc, char *argv[], int real_argc, char *real_argv[], const cha
13831380 * caution: -s can not be used together with -t.
13841381 * ----------------
13851382 */
1386- tmp = NULL ;
13871383 switch (optarg [0 ])
13881384 {
13891385 case 'p' :
13901386 if (optarg [1 ] == 'a' )
1391- tmp = "show_parser_stats" ;
1387+ Show_parser_stats = 1 ;
13921388 else if (optarg [1 ] == 'l' )
1393- tmp = "show_planner_stats" ;
1389+ Show_planner_stats = 1 ;
13941390 else
13951391 errs ++ ;
13961392 break ;
13971393 case 'e' :
1398- tmp = "show_parser_stats" ;
1394+ Show_executor_stats = 1 ;
13991395 break ;
14001396 default :
14011397 errs ++ ;
14021398 break ;
14031399 }
1404- if (tmp )
1405- SetConfigOption (tmp , "true" , ctx , true);
14061400 break ;
14071401
14081402 case 'v' :
@@ -1466,7 +1460,9 @@ PostgresMain(int argc, char *argv[], int real_argc, char *real_argv[], const cha
14661460 elog (ERROR , "-c %s requires argument" , optarg );
14671461 }
14681462
1469- SetConfigOption (name , value , ctx , true);
1463+ /* all options are allowed if not under postmaster */
1464+ SetConfigOption (name , value ,
1465+ (IsUnderPostmaster ) ? PGC_BACKEND : PGC_POSTMASTER , true);
14701466 free (name );
14711467 if (value )
14721468 free (value );
@@ -1713,7 +1709,7 @@ PostgresMain(int argc, char *argv[], int real_argc, char *real_argv[], const cha
17131709 if (!IsUnderPostmaster )
17141710 {
17151711 puts ("\nPOSTGRES backend interactive interface " );
1716- puts ("$Revision: 1.221 $ $Date: 2001/06/18 23:42:32 $\n" );
1712+ puts ("$Revision: 1.222 $ $Date: 2001/06/19 23:40:10 $\n" );
17171713 }
17181714
17191715 /*
0 commit comments