8
8
*
9
9
*
10
10
* 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 $
12
12
*
13
13
* NOTES
14
14
* 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
1108
1108
const char * DBName = NULL ;
1109
1109
bool secure = true;
1110
1110
int errs = 0 ;
1111
- GucContext ctx ;
1112
- char * tmp ;
1113
1111
1114
1112
int firstchar ;
1115
1113
StringInfo parser_input ;
@@ -1119,9 +1117,6 @@ PostgresMain(int argc, char *argv[], int real_argc, char *real_argv[], const cha
1119
1117
1120
1118
char * potential_DataDir = NULL ;
1121
1119
1122
- /* all options are allowed if not under postmaster */
1123
- ctx = IsUnderPostmaster ? PGC_BACKEND : PGC_POSTMASTER ;
1124
-
1125
1120
/*
1126
1121
* Catch standard options before doing much else. This even works on
1127
1122
* systems without getopt_long.
@@ -1193,7 +1188,7 @@ PostgresMain(int argc, char *argv[], int real_argc, char *real_argv[], const cha
1193
1188
{
1194
1189
case 'A' :
1195
1190
#ifdef USE_ASSERT_CHECKING
1196
- SetConfigOption ( "debug_assertions" , optarg , ctx , true );
1191
+ assert_enabled = atoi ( optarg );
1197
1192
#else
1198
1193
fprintf (stderr , "Assert checking is not compiled in\n" );
1199
1194
#endif
@@ -1205,7 +1200,7 @@ PostgresMain(int argc, char *argv[], int real_argc, char *real_argv[], const cha
1205
1200
* specify the size of buffer pool
1206
1201
*/
1207
1202
if (secure )
1208
- SetConfigOption ( "shared_buffers" , optarg , ctx , true );
1203
+ NBuffers = atoi ( optarg );
1209
1204
break ;
1210
1205
1211
1206
case 'C' :
@@ -1222,18 +1217,17 @@ PostgresMain(int argc, char *argv[], int real_argc, char *real_argv[], const cha
1222
1217
break ;
1223
1218
1224
1219
case 'd' : /* debug level */
1225
- tmp = "true" ;
1226
- SetConfigOption ("debug_level" , optarg , ctx , true);
1220
+ DebugLvl = atoi (optarg );
1227
1221
if (DebugLvl >= 1 );
1228
- SetConfigOption ( "log_connections" , tmp , ctx , true) ;
1222
+ Log_connections = true;
1229
1223
if (DebugLvl >= 2 )
1230
- SetConfigOption ( "debug_print_query" , tmp , ctx , true) ;
1224
+ Debug_print_query = true;
1231
1225
if (DebugLvl >= 3 )
1232
- SetConfigOption ( "debug_print_parse" , tmp , ctx , true) ;
1226
+ Debug_print_parse = true;
1233
1227
if (DebugLvl >= 4 )
1234
- SetConfigOption ( "debug_print_plan" , tmp , ctx , true) ;
1228
+ Debug_print_plan = true;
1235
1229
if (DebugLvl >= 5 )
1236
- SetConfigOption ( "debug_print_rewritten" , tmp , ctx , true) ;
1230
+ Debug_print_rewritten = true;
1237
1231
break ;
1238
1232
1239
1233
case 'E' :
@@ -1258,40 +1252,37 @@ PostgresMain(int argc, char *argv[], int real_argc, char *real_argv[], const cha
1258
1252
* turn off fsync
1259
1253
*/
1260
1254
if (secure )
1261
- SetConfigOption ( "fsync" , "true" , ctx , true) ;
1255
+ enableFsync = false ;
1262
1256
break ;
1263
1257
1264
1258
case 'f' :
1265
1259
1266
1260
/*
1267
1261
* f - forbid generation of certain plans
1268
1262
*/
1269
- tmp = NULL ;
1270
1263
switch (optarg [0 ])
1271
1264
{
1272
1265
case 's' : /* seqscan */
1273
- tmp = "enable_seqscan" ;
1266
+ enable_seqscan = false ;
1274
1267
break ;
1275
1268
case 'i' : /* indexscan */
1276
- tmp = "enable_indexscan" ;
1269
+ enable_indexscan = false ;
1277
1270
break ;
1278
1271
case 't' : /* tidscan */
1279
- tmp = "enable_tidscan" ;
1272
+ enable_tidscan = false ;
1280
1273
break ;
1281
1274
case 'n' : /* nestloop */
1282
- tmp = "enable_nestloop" ;
1275
+ enable_nestloop = false ;
1283
1276
break ;
1284
1277
case 'm' : /* mergejoin */
1285
- tmp = "enable_mergejoin" ;
1278
+ enable_mergejoin = false ;
1286
1279
break ;
1287
1280
case 'h' : /* hashjoin */
1288
- tmp = "enable_hashjoin" ;
1281
+ enable_hashjoin = false ;
1289
1282
break ;
1290
1283
default :
1291
1284
errs ++ ;
1292
1285
}
1293
- if (tmp )
1294
- SetConfigOption (tmp , "false" , ctx , true);
1295
1286
break ;
1296
1287
1297
1288
case 'i' :
@@ -1361,15 +1352,21 @@ PostgresMain(int argc, char *argv[], int real_argc, char *real_argv[], const cha
1361
1352
/*
1362
1353
* S - amount of sort memory to use in 1k bytes
1363
1354
*/
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
+ }
1365
1362
break ;
1366
1363
1367
1364
case 's' :
1368
1365
1369
1366
/*
1370
1367
* s - report usage statistics (timings) after each query
1371
1368
*/
1372
- SetConfigOption ( "show_query_stats" , optarg , ctx , true) ;
1369
+ Show_query_stats = 1 ;
1373
1370
break ;
1374
1371
1375
1372
case 't' :
@@ -1383,26 +1380,23 @@ PostgresMain(int argc, char *argv[], int real_argc, char *real_argv[], const cha
1383
1380
* caution: -s can not be used together with -t.
1384
1381
* ----------------
1385
1382
*/
1386
- tmp = NULL ;
1387
1383
switch (optarg [0 ])
1388
1384
{
1389
1385
case 'p' :
1390
1386
if (optarg [1 ] == 'a' )
1391
- tmp = "show_parser_stats" ;
1387
+ Show_parser_stats = 1 ;
1392
1388
else if (optarg [1 ] == 'l' )
1393
- tmp = "show_planner_stats" ;
1389
+ Show_planner_stats = 1 ;
1394
1390
else
1395
1391
errs ++ ;
1396
1392
break ;
1397
1393
case 'e' :
1398
- tmp = "show_parser_stats" ;
1394
+ Show_executor_stats = 1 ;
1399
1395
break ;
1400
1396
default :
1401
1397
errs ++ ;
1402
1398
break ;
1403
1399
}
1404
- if (tmp )
1405
- SetConfigOption (tmp , "true" , ctx , true);
1406
1400
break ;
1407
1401
1408
1402
case 'v' :
@@ -1466,7 +1460,9 @@ PostgresMain(int argc, char *argv[], int real_argc, char *real_argv[], const cha
1466
1460
elog (ERROR , "-c %s requires argument" , optarg );
1467
1461
}
1468
1462
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);
1470
1466
free (name );
1471
1467
if (value )
1472
1468
free (value );
@@ -1713,7 +1709,7 @@ PostgresMain(int argc, char *argv[], int real_argc, char *real_argv[], const cha
1713
1709
if (!IsUnderPostmaster )
1714
1710
{
1715
1711
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" );
1717
1713
}
1718
1714
1719
1715
/*
0 commit comments