Location via proxy:   [ UP ]  
[Report a bug]   [Manage cookies]                
Skip to content

Commit 6a7f23c

Browse files
committed
> Marko Kreen <marko@l-t.ee> writes:
> > secure_ctx changes too. it will be PGC_BACKEND after '-p'. > > Oh, okay, I missed that part. Could we see the total state of the > patch --- ie, a diff against current CVS, not a bunch of deltas? > I've gotten confused about what's in and what's out. Ok, here it is. Cleared the ctx comment too - after -p it will be PGC_BACKEND in any case. Marko Kreen
1 parent 2e2d17e commit 6a7f23c

File tree

6 files changed

+70
-58
lines changed

6 files changed

+70
-58
lines changed

src/backend/parser/parse_coerce.c

Lines changed: 5 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -8,7 +8,7 @@
88
*
99
*
1010
* IDENTIFICATION
11-
* $Header: /cvsroot/pgsql/src/backend/parser/parse_coerce.c,v 2.58 2001/06/19 22:39:11 tgl Exp $
11+
* $Header: /cvsroot/pgsql/src/backend/parser/parse_coerce.c,v 2.59 2001/06/23 22:23:49 momjian Exp $
1212
*
1313
*-------------------------------------------------------------------------
1414
*/
@@ -470,6 +470,7 @@ TypeCategory(Oid inType)
470470

471471
case (CHAROID):
472472
case (NAMEOID):
473+
case (BYTEAOID):
473474
case (BPCHAROID):
474475
case (VARCHAROID):
475476
case (TEXTOID):
@@ -614,6 +615,7 @@ PromoteTypeToNext(Oid inType)
614615
result = VARCHAROID;
615616
break;
616617

618+
case (BYTEAOID):
617619
case (VARCHAROID):
618620
result = TEXTOID;
619621
break;
@@ -708,6 +710,7 @@ PromoteLesserType(Oid inType1, Oid inType2, Oid *newType1, Oid *newType2)
708710
case (CHAROID):
709711
switch (*arg2)
710712
{
713+
case (BYTEAOID):
711714
case (BPCHAROID):
712715
case (VARCHAROID):
713716
case (TEXTOID):
@@ -772,6 +775,7 @@ PromoteLesserType(Oid inType1, Oid inType2, Oid *newType1, Oid *newType2)
772775
case (CHAROID):
773776
switch (*arg2)
774777
{
778+
case (BYTEAOID):
775779
case (BPCHAROID):
776780
case (VARCHAROID):
777781
case (TEXTOID):

src/backend/parser/parse_target.c

Lines changed: 5 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -8,7 +8,7 @@
88
*
99
*
1010
* IDENTIFICATION
11-
* $Header: /cvsroot/pgsql/src/backend/parser/parse_target.c,v 1.67 2001/05/21 18:42:08 momjian Exp $
11+
* $Header: /cvsroot/pgsql/src/backend/parser/parse_target.c,v 1.68 2001/06/23 22:23:49 momjian Exp $
1212
*
1313
*-------------------------------------------------------------------------
1414
*/
@@ -56,7 +56,7 @@ transformTargetEntry(ParseState *pstate,
5656
expr = transformExpr(pstate, node, EXPR_COLUMN_FIRST);
5757

5858
if (IsA(expr, Ident) && ((Ident *)expr)->isRel)
59-
elog(ERROR,"You can't use relation names alone in the target list, try relation.*.");
59+
elog(ERROR,"You can't use relation names alone in the target list, try relation.*.");
6060

6161
type_id = exprType(expr);
6262
type_mod = exprTypmod(expr);
@@ -311,7 +311,9 @@ CoerceTargetExpr(ParseState *pstate,
311311
* string hacks to get transparent conversions w/o explicit
312312
* conversions
313313
*/
314-
else if ((attrtype == BPCHAROID) || (attrtype == VARCHAROID))
314+
else if (attrtype == BPCHAROID ||
315+
attrtype == VARCHAROID ||
316+
attrtype == BYTEAOID)
315317
{
316318
Oid text_id = TEXTOID;
317319

src/backend/postmaster/postmaster.c

Lines changed: 12 additions & 16 deletions
Original file line numberDiff line numberDiff line change
@@ -37,7 +37,7 @@
3737
*
3838
*
3939
* IDENTIFICATION
40-
* $Header: /cvsroot/pgsql/src/backend/postmaster/postmaster.c,v 1.226 2001/06/22 19:16:22 wieck Exp $
40+
* $Header: /cvsroot/pgsql/src/backend/postmaster/postmaster.c,v 1.227 2001/06/23 22:23:49 momjian Exp $
4141
*
4242
* NOTES
4343
*
@@ -431,14 +431,14 @@ PostmasterMain(int argc, char *argv[])
431431
#ifndef USE_ASSERT_CHECKING
432432
postmaster_error("Assert checking is not compiled in.");
433433
#else
434-
assert_enabled = atoi(optarg);
434+
SetConfigOption("debug_assertions", optarg, PGC_POSTMASTER, true);
435435
#endif
436436
break;
437437
case 'a':
438438
/* Can no longer set authentication method. */
439439
break;
440440
case 'B':
441-
NBuffers = atoi(optarg);
441+
SetConfigOption("shared_buffers", optarg, PGC_POSTMASTER, true);
442442
break;
443443
case 'b':
444444
/* Can no longer set the backend executable file to use. */
@@ -452,23 +452,23 @@ PostmasterMain(int argc, char *argv[])
452452
* Turn on debugging for the postmaster and the backend
453453
* servers descended from it.
454454
*/
455-
DebugLvl = atoi(optarg);
455+
SetConfigOption("debug_level", optarg, PGC_POSTMASTER, true);
456456
break;
457457
case 'F':
458-
enableFsync = false;
458+
SetConfigOption("enable_fsync", "false", PGC_POSTMASTER, true);
459459
break;
460460
case 'h':
461-
VirtualHost = optarg;
461+
SetConfigOption("virtual_host", optarg, PGC_POSTMASTER, true);
462462
break;
463463
case 'i':
464-
NetServer = true;
464+
SetConfigOption("tcpip_socket", "true", PGC_POSTMASTER, true);
465465
break;
466466
case 'k':
467-
UnixSocketDir = optarg;
467+
SetConfigOption("unix_socket_directory", optarg, PGC_POSTMASTER, true);
468468
break;
469469
#ifdef USE_SSL
470470
case 'l':
471-
EnableSSL = true;
471+
SetConfigOption("ssl", "true", PGC_POSTMASTER, true);
472472
break;
473473
#endif
474474
case 'm':
@@ -488,11 +488,7 @@ PostmasterMain(int argc, char *argv[])
488488
* The max number of backends to start. Can't set to less
489489
* than 1 or more than compiled-in limit.
490490
*/
491-
MaxBackends = atoi(optarg);
492-
if (MaxBackends < 1)
493-
MaxBackends = 1;
494-
if (MaxBackends > MAXBACKENDS)
495-
MaxBackends = MAXBACKENDS;
491+
SetConfigOption("max_connections", optarg, PGC_POSTMASTER, true);
496492
break;
497493
case 'n':
498494
/* Don't reinit shared mem after abnormal exit */
@@ -509,7 +505,7 @@ PostmasterMain(int argc, char *argv[])
509505
strcpy(original_extraoptions, optarg);
510506
break;
511507
case 'p':
512-
PostPortNumber = atoi(optarg);
508+
SetConfigOption("port", optarg, PGC_POSTMASTER, true);
513509
break;
514510
case 'S':
515511

@@ -519,7 +515,7 @@ PostmasterMain(int argc, char *argv[])
519515
* it's most badly needed on SysV-derived systems like
520516
* SVR4 and HP-UX.
521517
*/
522-
SilentMode = true;
518+
SetConfigOption("silent_mode", "true", PGC_POSTMASTER, true);
523519
break;
524520
case 's':
525521

src/backend/tcop/postgres.c

Lines changed: 37 additions & 34 deletions
Original file line numberDiff line numberDiff line change
@@ -8,7 +8,7 @@
88
*
99
*
1010
* IDENTIFICATION
11-
* $Header: /cvsroot/pgsql/src/backend/tcop/postgres.c,v 1.224 2001/06/22 19:16:23 wieck Exp $
11+
* $Header: /cvsroot/pgsql/src/backend/tcop/postgres.c,v 1.225 2001/06/23 22:23:49 momjian Exp $
1212
*
1313
* NOTES
1414
* this is the "main" module of the postgres backend and
@@ -1110,6 +1110,8 @@ PostgresMain(int argc, char *argv[], int real_argc, char *real_argv[], const cha
11101110
const char *DBName = NULL;
11111111
bool secure = true;
11121112
int errs = 0;
1113+
GucContext ctx;
1114+
char *tmp;
11131115

11141116
int firstchar;
11151117
StringInfo parser_input;
@@ -1119,6 +1121,9 @@ PostgresMain(int argc, char *argv[], int real_argc, char *real_argv[], const cha
11191121

11201122
char *potential_DataDir = NULL;
11211123

1124+
/* all options are allowed until '-p' */
1125+
ctx = PGC_POSTMASTER;
1126+
11221127
/*
11231128
* Catch standard options before doing much else. This even works on
11241129
* systems without getopt_long.
@@ -1192,7 +1197,7 @@ PostgresMain(int argc, char *argv[], int real_argc, char *real_argv[], const cha
11921197
{
11931198
case 'A':
11941199
#ifdef USE_ASSERT_CHECKING
1195-
assert_enabled = atoi(optarg);
1200+
SetConfigOption("debug_assertions", optarg, ctx, true);
11961201
#else
11971202
fprintf(stderr, "Assert checking is not compiled in\n");
11981203
#endif
@@ -1203,8 +1208,7 @@ PostgresMain(int argc, char *argv[], int real_argc, char *real_argv[], const cha
12031208
/*
12041209
* specify the size of buffer pool
12051210
*/
1206-
if (secure)
1207-
NBuffers = atoi(optarg);
1211+
SetConfigOption("shared_buffers", optarg, ctx, true);
12081212
break;
12091213

12101214
case 'C':
@@ -1221,17 +1225,18 @@ PostgresMain(int argc, char *argv[], int real_argc, char *real_argv[], const cha
12211225
break;
12221226

12231227
case 'd': /* debug level */
1224-
DebugLvl = atoi(optarg);
1225-
if (DebugLvl >= 1);
1226-
Log_connections = true;
1228+
tmp = "true";
1229+
SetConfigOption("debug_level", optarg, ctx, true);
1230+
if (DebugLvl >= 1)
1231+
SetConfigOption("log_connections", tmp, ctx, true);
12271232
if (DebugLvl >= 2)
1228-
Debug_print_query = true;
1233+
SetConfigOption("debug_print_query", tmp, ctx, true);
12291234
if (DebugLvl >= 3)
1230-
Debug_print_parse = true;
1235+
SetConfigOption("debug_print_parse", tmp, ctx, true);
12311236
if (DebugLvl >= 4)
1232-
Debug_print_plan = true;
1237+
SetConfigOption("debug_print_plan", tmp, ctx, true);
12331238
if (DebugLvl >= 5)
1234-
Debug_print_rewritten = true;
1239+
SetConfigOption("debug_print_rewritten", tmp, ctx, true);
12351240
break;
12361241

12371242
case 'E':
@@ -1255,38 +1260,40 @@ PostgresMain(int argc, char *argv[], int real_argc, char *real_argv[], const cha
12551260
/*
12561261
* turn off fsync
12571262
*/
1258-
if (secure)
1259-
enableFsync = false;
1263+
SetConfigOption("fsync", "false", ctx, true);
12601264
break;
12611265

12621266
case 'f':
12631267

12641268
/*
12651269
* f - forbid generation of certain plans
12661270
*/
1271+
tmp = NULL;
12671272
switch (optarg[0])
12681273
{
12691274
case 's': /* seqscan */
1270-
enable_seqscan = false;
1275+
tmp = "enable_seqscan";
12711276
break;
12721277
case 'i': /* indexscan */
1273-
enable_indexscan = false;
1278+
tmp = "enable_indexscan";
12741279
break;
12751280
case 't': /* tidscan */
1276-
enable_tidscan = false;
1281+
tmp = "enable_tidscan";
12771282
break;
12781283
case 'n': /* nestloop */
1279-
enable_nestloop = false;
1284+
tmp = "enable_nestloop";
12801285
break;
12811286
case 'm': /* mergejoin */
1282-
enable_mergejoin = false;
1287+
tmp = "enable_mergejoin";
12831288
break;
12841289
case 'h': /* hashjoin */
1285-
enable_hashjoin = false;
1290+
tmp = "enable_hashjoin";
12861291
break;
12871292
default:
12881293
errs++;
12891294
}
1295+
if (tmp)
1296+
SetConfigOption(tmp, "false", ctx, true);
12901297
break;
12911298

12921299
case 'i':
@@ -1348,6 +1355,7 @@ PostgresMain(int argc, char *argv[], int real_argc, char *real_argv[], const cha
13481355
DBName = strdup(optarg);
13491356
secure = false; /* subsequent switches are NOT
13501357
* secure */
1358+
ctx = PGC_BACKEND;
13511359
}
13521360
break;
13531361

@@ -1356,21 +1364,15 @@ PostgresMain(int argc, char *argv[], int real_argc, char *real_argv[], const cha
13561364
/*
13571365
* S - amount of sort memory to use in 1k bytes
13581366
*/
1359-
{
1360-
int S;
1361-
1362-
S = atoi(optarg);
1363-
if (S >= 4 * BLCKSZ / 1024)
1364-
SortMem = S;
1365-
}
1367+
SetConfigOption("sort_mem", optarg, ctx, true);
13661368
break;
13671369

13681370
case 's':
13691371

13701372
/*
13711373
* s - report usage statistics (timings) after each query
13721374
*/
1373-
Show_query_stats = 1;
1375+
SetConfigOption("show_query_stats", "true", ctx, true);
13741376
break;
13751377

13761378
case 't':
@@ -1384,23 +1386,26 @@ PostgresMain(int argc, char *argv[], int real_argc, char *real_argv[], const cha
13841386
* caution: -s can not be used together with -t.
13851387
* ----------------
13861388
*/
1389+
tmp = NULL;
13871390
switch (optarg[0])
13881391
{
13891392
case 'p':
13901393
if (optarg[1] == 'a')
1391-
Show_parser_stats = 1;
1394+
tmp = "show_parser_stats";
13921395
else if (optarg[1] == 'l')
1393-
Show_planner_stats = 1;
1396+
tmp = "show_planner_stats";
13941397
else
13951398
errs++;
13961399
break;
13971400
case 'e':
1398-
Show_executor_stats = 1;
1401+
tmp = "show_parser_stats";
13991402
break;
14001403
default:
14011404
errs++;
14021405
break;
14031406
}
1407+
if (tmp)
1408+
SetConfigOption(tmp, "true", ctx, true);
14041409
break;
14051410

14061411
case 'v':
@@ -1464,9 +1469,7 @@ PostgresMain(int argc, char *argv[], int real_argc, char *real_argv[], const cha
14641469
elog(ERROR, "-c %s requires argument", optarg);
14651470
}
14661471

1467-
/* all options are allowed if not under postmaster */
1468-
SetConfigOption(name, value,
1469-
(IsUnderPostmaster) ? PGC_BACKEND : PGC_POSTMASTER, true);
1472+
SetConfigOption(name, value, ctx, true);
14701473
free(name);
14711474
if (value)
14721475
free(value);
@@ -1711,7 +1714,7 @@ PostgresMain(int argc, char *argv[], int real_argc, char *real_argv[], const cha
17111714
if (!IsUnderPostmaster)
17121715
{
17131716
puts("\nPOSTGRES backend interactive interface ");
1714-
puts("$Revision: 1.224 $ $Date: 2001/06/22 19:16:23 $\n");
1717+
puts("$Revision: 1.225 $ $Date: 2001/06/23 22:23:49 $\n");
17151718
}
17161719

17171720
/*

src/backend/utils/misc/guc.c

Lines changed: 3 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -4,7 +4,7 @@
44
* Support for grand unified configuration scheme, including SET
55
* command, configuration file, and command line options.
66
*
7-
* $Header: /cvsroot/pgsql/src/backend/utils/misc/guc.c,v 1.41 2001/06/19 23:40:10 momjian Exp $
7+
* $Header: /cvsroot/pgsql/src/backend/utils/misc/guc.c,v 1.42 2001/06/23 22:23:49 momjian Exp $
88
*
99
* Copyright 2000 by PostgreSQL Global Development Group
1010
* Written by Peter Eisentraut <peter_e@gmx.net>.
@@ -196,7 +196,7 @@ static struct config_bool
196196
{"fsync", PGC_SIGHUP, &enableFsync, true, NULL},
197197
{"silent_mode", PGC_POSTMASTER, &SilentMode, false, NULL},
198198

199-
{"log_connections", PGC_SIGHUP, &Log_connections, false, NULL},
199+
{"log_connections", PGC_BACKEND, &Log_connections, false, NULL},
200200
{"log_timestamp", PGC_SIGHUP, &Log_timestamp, false, NULL},
201201
{"log_pid", PGC_SIGHUP, &Log_pid, false, NULL},
202202

@@ -276,7 +276,7 @@ static struct config_int
276276
DEF_PGPORT, 1, 65535, NULL, NULL},
277277

278278
{"sort_mem", PGC_USERSET, &SortMem,
279-
512, 1, INT_MAX, NULL, NULL},
279+
512, 4*BLCKSZ/1024, INT_MAX, NULL, NULL},
280280

281281
{"debug_level", PGC_USERSET, &DebugLvl,
282282
0, 0, 16, NULL, NULL},

0 commit comments

Comments
 (0)