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
11081108const char * DBName = NULL ;
11091109bool secure = true;
11101110int errs = 0 ;
1111- GucContext ctx ;
1112- char * tmp ;
11131111
11141112int firstchar ;
11151113StringInfo parser_input ;
@@ -1119,9 +1117,6 @@ PostgresMain(int argc, char *argv[], int real_argc, char *real_argv[], const cha
11191117
11201118char * 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{
11941189case 'A' :
11951190#ifdef USE_ASSERT_CHECKING
1196- SetConfigOption ( "debug_assertions" , optarg , ctx , true );
1191+ assert_enabled = atoi ( optarg );
11971192#else
11981193fprintf (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 */
12071202if (secure )
1208- SetConfigOption ( "shared_buffers" , optarg , ctx , true );
1203+ NBuffers = atoi ( optarg );
12091204break ;
12101205
12111206case 'C' :
@@ -1222,18 +1217,17 @@ PostgresMain(int argc, char *argv[], int real_argc, char *real_argv[], const cha
12221217break ;
12231218
12241219case 'd' :/* debug level */
1225- tmp = "true" ;
1226- SetConfigOption ("debug_level" ,optarg ,ctx , true);
1220+ DebugLvl = atoi (optarg );
12271221if (DebugLvl >=1 );
1228- SetConfigOption ( "log_connections" , tmp , ctx , true) ;
1222+ Log_connections = true;
12291223if (DebugLvl >=2 )
1230- SetConfigOption ( "debug_print_query" , tmp , ctx , true) ;
1224+ Debug_print_query = true;
12311225if (DebugLvl >=3 )
1232- SetConfigOption ( "debug_print_parse" , tmp , ctx , true) ;
1226+ Debug_print_parse = true;
12331227if (DebugLvl >=4 )
1234- SetConfigOption ( "debug_print_plan" , tmp , ctx , true) ;
1228+ Debug_print_plan = true;
12351229if (DebugLvl >=5 )
1236- SetConfigOption ( "debug_print_rewritten" , tmp , ctx , true) ;
1230+ Debug_print_rewritten = true;
12371231break ;
12381232
12391233case 'E' :
@@ -1258,40 +1252,37 @@ PostgresMain(int argc, char *argv[], int real_argc, char *real_argv[], const cha
12581252 * turn off fsync
12591253 */
12601254if (secure )
1261- SetConfigOption ( "fsync" , "true" , ctx , true) ;
1255+ enableFsync = false ;
12621256break ;
12631257
12641258case 'f' :
12651259
12661260/*
12671261 * f - forbid generation of certain plans
12681262 */
1269- tmp = NULL ;
12701263switch (optarg [0 ])
12711264{
12721265case 's' :/* seqscan */
1273- tmp = "enable_seqscan" ;
1266+ enable_seqscan = false ;
12741267break ;
12751268case 'i' :/* indexscan */
1276- tmp = "enable_indexscan" ;
1269+ enable_indexscan = false ;
12771270break ;
12781271case 't' :/* tidscan */
1279- tmp = "enable_tidscan" ;
1272+ enable_tidscan = false ;
12801273break ;
12811274case 'n' :/* nestloop */
1282- tmp = "enable_nestloop" ;
1275+ enable_nestloop = false ;
12831276break ;
12841277case 'm' :/* mergejoin */
1285- tmp = "enable_mergejoin" ;
1278+ enable_mergejoin = false ;
12861279break ;
12871280case 'h' :/* hashjoin */
1288- tmp = "enable_hashjoin" ;
1281+ enable_hashjoin = false ;
12891282break ;
12901283default :
12911284errs ++ ;
12921285}
1293- if (tmp )
1294- SetConfigOption (tmp ,"false" ,ctx , true);
12951286break ;
12961287
12971288case '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+ }
13651362break ;
13661363
13671364case '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 ;
13731370break ;
13741371
13751372case '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 ;
13871383switch (optarg [0 ])
13881384{
13891385case 'p' :
13901386if (optarg [1 ]== 'a' )
1391- tmp = "show_parser_stats" ;
1387+ Show_parser_stats = 1 ;
13921388else if (optarg [1 ]== 'l' )
1393- tmp = "show_planner_stats" ;
1389+ Show_planner_stats = 1 ;
13941390else
13951391errs ++ ;
13961392break ;
13971393case 'e' :
1398- tmp = "show_parser_stats" ;
1394+ Show_executor_stats = 1 ;
13991395break ;
14001396default :
14011397errs ++ ;
14021398break ;
14031399}
1404- if (tmp )
1405- SetConfigOption (tmp ,"true" ,ctx , true);
14061400break ;
14071401
14081402case 'v' :
@@ -1466,7 +1460,9 @@ PostgresMain(int argc, char *argv[], int real_argc, char *real_argv[], const cha
14661460elog (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);
14701466free (name );
14711467if (value )
14721468free (value );
@@ -1713,7 +1709,7 @@ PostgresMain(int argc, char *argv[], int real_argc, char *real_argv[], const cha
17131709if (!IsUnderPostmaster )
17141710{
17151711puts ("\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/*