Commit 6a7f23c2 authored by Bruce Momjian's avatar Bruce Momjian

> 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
parent 2e2d17ed
...@@ -8,7 +8,7 @@ ...@@ -8,7 +8,7 @@
* *
* *
* IDENTIFICATION * IDENTIFICATION
* $Header: /cvsroot/pgsql/src/backend/parser/parse_coerce.c,v 2.58 2001/06/19 22:39:11 tgl Exp $ * $Header: /cvsroot/pgsql/src/backend/parser/parse_coerce.c,v 2.59 2001/06/23 22:23:49 momjian Exp $
* *
*------------------------------------------------------------------------- *-------------------------------------------------------------------------
*/ */
...@@ -470,6 +470,7 @@ TypeCategory(Oid inType) ...@@ -470,6 +470,7 @@ TypeCategory(Oid inType)
case (CHAROID): case (CHAROID):
case (NAMEOID): case (NAMEOID):
case (BYTEAOID):
case (BPCHAROID): case (BPCHAROID):
case (VARCHAROID): case (VARCHAROID):
case (TEXTOID): case (TEXTOID):
...@@ -614,6 +615,7 @@ PromoteTypeToNext(Oid inType) ...@@ -614,6 +615,7 @@ PromoteTypeToNext(Oid inType)
result = VARCHAROID; result = VARCHAROID;
break; break;
case (BYTEAOID):
case (VARCHAROID): case (VARCHAROID):
result = TEXTOID; result = TEXTOID;
break; break;
...@@ -708,6 +710,7 @@ PromoteLesserType(Oid inType1, Oid inType2, Oid *newType1, Oid *newType2) ...@@ -708,6 +710,7 @@ PromoteLesserType(Oid inType1, Oid inType2, Oid *newType1, Oid *newType2)
case (CHAROID): case (CHAROID):
switch (*arg2) switch (*arg2)
{ {
case (BYTEAOID):
case (BPCHAROID): case (BPCHAROID):
case (VARCHAROID): case (VARCHAROID):
case (TEXTOID): case (TEXTOID):
...@@ -772,6 +775,7 @@ PromoteLesserType(Oid inType1, Oid inType2, Oid *newType1, Oid *newType2) ...@@ -772,6 +775,7 @@ PromoteLesserType(Oid inType1, Oid inType2, Oid *newType1, Oid *newType2)
case (CHAROID): case (CHAROID):
switch (*arg2) switch (*arg2)
{ {
case (BYTEAOID):
case (BPCHAROID): case (BPCHAROID):
case (VARCHAROID): case (VARCHAROID):
case (TEXTOID): case (TEXTOID):
......
...@@ -8,7 +8,7 @@ ...@@ -8,7 +8,7 @@
* *
* *
* IDENTIFICATION * IDENTIFICATION
* $Header: /cvsroot/pgsql/src/backend/parser/parse_target.c,v 1.67 2001/05/21 18:42:08 momjian Exp $ * $Header: /cvsroot/pgsql/src/backend/parser/parse_target.c,v 1.68 2001/06/23 22:23:49 momjian Exp $
* *
*------------------------------------------------------------------------- *-------------------------------------------------------------------------
*/ */
...@@ -56,7 +56,7 @@ transformTargetEntry(ParseState *pstate, ...@@ -56,7 +56,7 @@ transformTargetEntry(ParseState *pstate,
expr = transformExpr(pstate, node, EXPR_COLUMN_FIRST); expr = transformExpr(pstate, node, EXPR_COLUMN_FIRST);
if (IsA(expr, Ident) && ((Ident *)expr)->isRel) if (IsA(expr, Ident) && ((Ident *)expr)->isRel)
elog(ERROR,"You can't use relation names alone in the target list, try relation.*."); elog(ERROR,"You can't use relation names alone in the target list, try relation.*.");
type_id = exprType(expr); type_id = exprType(expr);
type_mod = exprTypmod(expr); type_mod = exprTypmod(expr);
...@@ -311,7 +311,9 @@ CoerceTargetExpr(ParseState *pstate, ...@@ -311,7 +311,9 @@ CoerceTargetExpr(ParseState *pstate,
* string hacks to get transparent conversions w/o explicit * string hacks to get transparent conversions w/o explicit
* conversions * conversions
*/ */
else if ((attrtype == BPCHAROID) || (attrtype == VARCHAROID)) else if (attrtype == BPCHAROID ||
attrtype == VARCHAROID ||
attrtype == BYTEAOID)
{ {
Oid text_id = TEXTOID; Oid text_id = TEXTOID;
......
...@@ -37,7 +37,7 @@ ...@@ -37,7 +37,7 @@
* *
* *
* IDENTIFICATION * IDENTIFICATION
* $Header: /cvsroot/pgsql/src/backend/postmaster/postmaster.c,v 1.226 2001/06/22 19:16:22 wieck Exp $ * $Header: /cvsroot/pgsql/src/backend/postmaster/postmaster.c,v 1.227 2001/06/23 22:23:49 momjian Exp $
* *
* NOTES * NOTES
* *
...@@ -431,14 +431,14 @@ PostmasterMain(int argc, char *argv[]) ...@@ -431,14 +431,14 @@ PostmasterMain(int argc, char *argv[])
#ifndef USE_ASSERT_CHECKING #ifndef USE_ASSERT_CHECKING
postmaster_error("Assert checking is not compiled in."); postmaster_error("Assert checking is not compiled in.");
#else #else
assert_enabled = atoi(optarg); SetConfigOption("debug_assertions", optarg, PGC_POSTMASTER, true);
#endif #endif
break; break;
case 'a': case 'a':
/* Can no longer set authentication method. */ /* Can no longer set authentication method. */
break; break;
case 'B': case 'B':
NBuffers = atoi(optarg); SetConfigOption("shared_buffers", optarg, PGC_POSTMASTER, true);
break; break;
case 'b': case 'b':
/* Can no longer set the backend executable file to use. */ /* Can no longer set the backend executable file to use. */
...@@ -452,23 +452,23 @@ PostmasterMain(int argc, char *argv[]) ...@@ -452,23 +452,23 @@ PostmasterMain(int argc, char *argv[])
* Turn on debugging for the postmaster and the backend * Turn on debugging for the postmaster and the backend
* servers descended from it. * servers descended from it.
*/ */
DebugLvl = atoi(optarg); SetConfigOption("debug_level", optarg, PGC_POSTMASTER, true);
break; break;
case 'F': case 'F':
enableFsync = false; SetConfigOption("enable_fsync", "false", PGC_POSTMASTER, true);
break; break;
case 'h': case 'h':
VirtualHost = optarg; SetConfigOption("virtual_host", optarg, PGC_POSTMASTER, true);
break; break;
case 'i': case 'i':
NetServer = true; SetConfigOption("tcpip_socket", "true", PGC_POSTMASTER, true);
break; break;
case 'k': case 'k':
UnixSocketDir = optarg; SetConfigOption("unix_socket_directory", optarg, PGC_POSTMASTER, true);
break; break;
#ifdef USE_SSL #ifdef USE_SSL
case 'l': case 'l':
EnableSSL = true; SetConfigOption("ssl", "true", PGC_POSTMASTER, true);
break; break;
#endif #endif
case 'm': case 'm':
...@@ -488,11 +488,7 @@ PostmasterMain(int argc, char *argv[]) ...@@ -488,11 +488,7 @@ PostmasterMain(int argc, char *argv[])
* The max number of backends to start. Can't set to less * The max number of backends to start. Can't set to less
* than 1 or more than compiled-in limit. * than 1 or more than compiled-in limit.
*/ */
MaxBackends = atoi(optarg); SetConfigOption("max_connections", optarg, PGC_POSTMASTER, true);
if (MaxBackends < 1)
MaxBackends = 1;
if (MaxBackends > MAXBACKENDS)
MaxBackends = MAXBACKENDS;
break; break;
case 'n': case 'n':
/* Don't reinit shared mem after abnormal exit */ /* Don't reinit shared mem after abnormal exit */
...@@ -509,7 +505,7 @@ PostmasterMain(int argc, char *argv[]) ...@@ -509,7 +505,7 @@ PostmasterMain(int argc, char *argv[])
strcpy(original_extraoptions, optarg); strcpy(original_extraoptions, optarg);
break; break;
case 'p': case 'p':
PostPortNumber = atoi(optarg); SetConfigOption("port", optarg, PGC_POSTMASTER, true);
break; break;
case 'S': case 'S':
...@@ -519,7 +515,7 @@ PostmasterMain(int argc, char *argv[]) ...@@ -519,7 +515,7 @@ PostmasterMain(int argc, char *argv[])
* it's most badly needed on SysV-derived systems like * it's most badly needed on SysV-derived systems like
* SVR4 and HP-UX. * SVR4 and HP-UX.
*/ */
SilentMode = true; SetConfigOption("silent_mode", "true", PGC_POSTMASTER, true);
break; break;
case 's': case 's':
......
...@@ -8,7 +8,7 @@ ...@@ -8,7 +8,7 @@
* *
* *
* IDENTIFICATION * IDENTIFICATION
* $Header: /cvsroot/pgsql/src/backend/tcop/postgres.c,v 1.224 2001/06/22 19:16:23 wieck Exp $ * $Header: /cvsroot/pgsql/src/backend/tcop/postgres.c,v 1.225 2001/06/23 22:23:49 momjian Exp $
* *
* NOTES * NOTES
* this is the "main" module of the postgres backend and * 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 ...@@ -1110,6 +1110,8 @@ PostgresMain(int argc, char *argv[], int real_argc, char *real_argv[], const cha
const char *DBName = NULL; const char *DBName = NULL;
bool secure = true; bool secure = true;
int errs = 0; int errs = 0;
GucContext ctx;
char *tmp;
int firstchar; int firstchar;
StringInfo parser_input; StringInfo parser_input;
...@@ -1119,6 +1121,9 @@ PostgresMain(int argc, char *argv[], int real_argc, char *real_argv[], const cha ...@@ -1119,6 +1121,9 @@ PostgresMain(int argc, char *argv[], int real_argc, char *real_argv[], const cha
char *potential_DataDir = NULL; char *potential_DataDir = NULL;
/* all options are allowed until '-p' */
ctx = PGC_POSTMASTER;
/* /*
* Catch standard options before doing much else. This even works on * Catch standard options before doing much else. This even works on
* systems without getopt_long. * systems without getopt_long.
...@@ -1192,7 +1197,7 @@ PostgresMain(int argc, char *argv[], int real_argc, char *real_argv[], const cha ...@@ -1192,7 +1197,7 @@ PostgresMain(int argc, char *argv[], int real_argc, char *real_argv[], const cha
{ {
case 'A': case 'A':
#ifdef USE_ASSERT_CHECKING #ifdef USE_ASSERT_CHECKING
assert_enabled = atoi(optarg); SetConfigOption("debug_assertions", optarg, ctx, true);
#else #else
fprintf(stderr, "Assert checking is not compiled in\n"); fprintf(stderr, "Assert checking is not compiled in\n");
#endif #endif
...@@ -1203,8 +1208,7 @@ PostgresMain(int argc, char *argv[], int real_argc, char *real_argv[], const cha ...@@ -1203,8 +1208,7 @@ PostgresMain(int argc, char *argv[], int real_argc, char *real_argv[], const cha
/* /*
* specify the size of buffer pool * specify the size of buffer pool
*/ */
if (secure) SetConfigOption("shared_buffers", optarg, ctx, true);
NBuffers = atoi(optarg);
break; break;
case 'C': case 'C':
...@@ -1221,17 +1225,18 @@ PostgresMain(int argc, char *argv[], int real_argc, char *real_argv[], const cha ...@@ -1221,17 +1225,18 @@ PostgresMain(int argc, char *argv[], int real_argc, char *real_argv[], const cha
break; break;
case 'd': /* debug level */ case 'd': /* debug level */
DebugLvl = atoi(optarg); tmp = "true";
if (DebugLvl >= 1); SetConfigOption("debug_level", optarg, ctx, true);
Log_connections = true; if (DebugLvl >= 1)
SetConfigOption("log_connections", tmp, ctx, true);
if (DebugLvl >= 2) if (DebugLvl >= 2)
Debug_print_query = true; SetConfigOption("debug_print_query", tmp, ctx, true);
if (DebugLvl >= 3) if (DebugLvl >= 3)
Debug_print_parse = true; SetConfigOption("debug_print_parse", tmp, ctx, true);
if (DebugLvl >= 4) if (DebugLvl >= 4)
Debug_print_plan = true; SetConfigOption("debug_print_plan", tmp, ctx, true);
if (DebugLvl >= 5) if (DebugLvl >= 5)
Debug_print_rewritten = true; SetConfigOption("debug_print_rewritten", tmp, ctx, true);
break; break;
case 'E': case 'E':
...@@ -1255,8 +1260,7 @@ PostgresMain(int argc, char *argv[], int real_argc, char *real_argv[], const cha ...@@ -1255,8 +1260,7 @@ PostgresMain(int argc, char *argv[], int real_argc, char *real_argv[], const cha
/* /*
* turn off fsync * turn off fsync
*/ */
if (secure) SetConfigOption("fsync", "false", ctx, true);
enableFsync = false;
break; break;
case 'f': case 'f':
...@@ -1264,29 +1268,32 @@ PostgresMain(int argc, char *argv[], int real_argc, char *real_argv[], const cha ...@@ -1264,29 +1268,32 @@ PostgresMain(int argc, char *argv[], int real_argc, char *real_argv[], const cha
/* /*
* f - forbid generation of certain plans * f - forbid generation of certain plans
*/ */
tmp = NULL;
switch (optarg[0]) switch (optarg[0])
{ {
case 's': /* seqscan */ case 's': /* seqscan */
enable_seqscan = false; tmp = "enable_seqscan";
break; break;
case 'i': /* indexscan */ case 'i': /* indexscan */
enable_indexscan = false; tmp = "enable_indexscan";
break; break;
case 't': /* tidscan */ case 't': /* tidscan */
enable_tidscan = false; tmp = "enable_tidscan";
break; break;
case 'n': /* nestloop */ case 'n': /* nestloop */
enable_nestloop = false; tmp = "enable_nestloop";
break; break;
case 'm': /* mergejoin */ case 'm': /* mergejoin */
enable_mergejoin = false; tmp = "enable_mergejoin";
break; break;
case 'h': /* hashjoin */ case 'h': /* hashjoin */
enable_hashjoin = false; tmp = "enable_hashjoin";
break; break;
default: default:
errs++; errs++;
} }
if (tmp)
SetConfigOption(tmp, "false", ctx, true);
break; break;
case 'i': case 'i':
...@@ -1348,6 +1355,7 @@ PostgresMain(int argc, char *argv[], int real_argc, char *real_argv[], const cha ...@@ -1348,6 +1355,7 @@ PostgresMain(int argc, char *argv[], int real_argc, char *real_argv[], const cha
DBName = strdup(optarg); DBName = strdup(optarg);
secure = false; /* subsequent switches are NOT secure = false; /* subsequent switches are NOT
* secure */ * secure */
ctx = PGC_BACKEND;
} }
break; break;
...@@ -1356,13 +1364,7 @@ PostgresMain(int argc, char *argv[], int real_argc, char *real_argv[], const cha ...@@ -1356,13 +1364,7 @@ PostgresMain(int argc, char *argv[], int real_argc, char *real_argv[], const cha
/* /*
* S - amount of sort memory to use in 1k bytes * S - amount of sort memory to use in 1k bytes
*/ */
{ SetConfigOption("sort_mem", optarg, ctx, true);
int S;
S = atoi(optarg);
if (S >= 4 * BLCKSZ / 1024)
SortMem = S;
}
break; break;
case 's': case 's':
...@@ -1370,7 +1372,7 @@ PostgresMain(int argc, char *argv[], int real_argc, char *real_argv[], const cha ...@@ -1370,7 +1372,7 @@ PostgresMain(int argc, char *argv[], int real_argc, char *real_argv[], const cha
/* /*
* s - report usage statistics (timings) after each query * s - report usage statistics (timings) after each query
*/ */
Show_query_stats = 1; SetConfigOption("show_query_stats", "true", ctx, true);
break; break;
case 't': case 't':
...@@ -1384,23 +1386,26 @@ PostgresMain(int argc, char *argv[], int real_argc, char *real_argv[], const cha ...@@ -1384,23 +1386,26 @@ PostgresMain(int argc, char *argv[], int real_argc, char *real_argv[], const cha
* caution: -s can not be used together with -t. * caution: -s can not be used together with -t.
* ---------------- * ----------------
*/ */
tmp = NULL;
switch (optarg[0]) switch (optarg[0])
{ {
case 'p': case 'p':
if (optarg[1] == 'a') if (optarg[1] == 'a')
Show_parser_stats = 1; tmp = "show_parser_stats";
else if (optarg[1] == 'l') else if (optarg[1] == 'l')
Show_planner_stats = 1; tmp = "show_planner_stats";
else else
errs++; errs++;
break; break;
case 'e': case 'e':
Show_executor_stats = 1; tmp = "show_parser_stats";
break; break;
default: default:
errs++; errs++;
break; break;
} }
if (tmp)
SetConfigOption(tmp, "true", ctx, true);
break; break;
case 'v': case 'v':
...@@ -1464,9 +1469,7 @@ PostgresMain(int argc, char *argv[], int real_argc, char *real_argv[], const cha ...@@ -1464,9 +1469,7 @@ PostgresMain(int argc, char *argv[], int real_argc, char *real_argv[], const cha
elog(ERROR, "-c %s requires argument", optarg); elog(ERROR, "-c %s requires argument", optarg);
} }
/* all options are allowed if not under postmaster */ SetConfigOption(name, value, ctx, true);
SetConfigOption(name, value,
(IsUnderPostmaster) ? PGC_BACKEND : PGC_POSTMASTER, true);
free(name); free(name);
if (value) if (value)
free(value); free(value);
...@@ -1711,7 +1714,7 @@ PostgresMain(int argc, char *argv[], int real_argc, char *real_argv[], const cha ...@@ -1711,7 +1714,7 @@ PostgresMain(int argc, char *argv[], int real_argc, char *real_argv[], const cha
if (!IsUnderPostmaster) if (!IsUnderPostmaster)
{ {
puts("\nPOSTGRES backend interactive interface "); puts("\nPOSTGRES backend interactive interface ");
puts("$Revision: 1.224 $ $Date: 2001/06/22 19:16:23 $\n"); puts("$Revision: 1.225 $ $Date: 2001/06/23 22:23:49 $\n");
} }
/* /*
......
...@@ -4,7 +4,7 @@ ...@@ -4,7 +4,7 @@
* Support for grand unified configuration scheme, including SET * Support for grand unified configuration scheme, including SET
* command, configuration file, and command line options. * command, configuration file, and command line options.
* *
* $Header: /cvsroot/pgsql/src/backend/utils/misc/guc.c,v 1.41 2001/06/19 23:40:10 momjian Exp $ * $Header: /cvsroot/pgsql/src/backend/utils/misc/guc.c,v 1.42 2001/06/23 22:23:49 momjian Exp $
* *
* Copyright 2000 by PostgreSQL Global Development Group * Copyright 2000 by PostgreSQL Global Development Group
* Written by Peter Eisentraut <peter_e@gmx.net>. * Written by Peter Eisentraut <peter_e@gmx.net>.
...@@ -196,7 +196,7 @@ static struct config_bool ...@@ -196,7 +196,7 @@ static struct config_bool
{"fsync", PGC_SIGHUP, &enableFsync, true, NULL}, {"fsync", PGC_SIGHUP, &enableFsync, true, NULL},
{"silent_mode", PGC_POSTMASTER, &SilentMode, false, NULL}, {"silent_mode", PGC_POSTMASTER, &SilentMode, false, NULL},
{"log_connections", PGC_SIGHUP, &Log_connections, false, NULL}, {"log_connections", PGC_BACKEND, &Log_connections, false, NULL},
{"log_timestamp", PGC_SIGHUP, &Log_timestamp, false, NULL}, {"log_timestamp", PGC_SIGHUP, &Log_timestamp, false, NULL},
{"log_pid", PGC_SIGHUP, &Log_pid, false, NULL}, {"log_pid", PGC_SIGHUP, &Log_pid, false, NULL},
...@@ -276,7 +276,7 @@ static struct config_int ...@@ -276,7 +276,7 @@ static struct config_int
DEF_PGPORT, 1, 65535, NULL, NULL}, DEF_PGPORT, 1, 65535, NULL, NULL},
{"sort_mem", PGC_USERSET, &SortMem, {"sort_mem", PGC_USERSET, &SortMem,
512, 1, INT_MAX, NULL, NULL}, 512, 4*BLCKSZ/1024, INT_MAX, NULL, NULL},
{"debug_level", PGC_USERSET, &DebugLvl, {"debug_level", PGC_USERSET, &DebugLvl,
0, 0, 16, NULL, NULL}, 0, 0, 16, NULL, NULL},
......
...@@ -7,7 +7,7 @@ ...@@ -7,7 +7,7 @@
* Portions Copyright (c) 1996-2001, PostgreSQL Global Development Group * Portions Copyright (c) 1996-2001, PostgreSQL Global Development Group
* Portions Copyright (c) 1994, Regents of the University of California * Portions Copyright (c) 1994, Regents of the University of California
* *
* $Id: parse_coerce.h,v 1.29 2001/06/19 22:39:12 tgl Exp $ * $Id: parse_coerce.h,v 1.30 2001/06/23 22:23:49 momjian Exp $
* *
*------------------------------------------------------------------------- *-------------------------------------------------------------------------
*/ */
...@@ -46,6 +46,7 @@ typedef enum CATEGORY ...@@ -46,6 +46,7 @@ typedef enum CATEGORY
|| ((t) == BPCHAROID) \ || ((t) == BPCHAROID) \
|| ((t) == VARCHAROID) \ || ((t) == VARCHAROID) \
|| ((t) == TEXTOID) \ || ((t) == TEXTOID) \
|| ((t) == BYTEAOID) \
|| ((t) == INT4OID) \ || ((t) == INT4OID) \
|| ((t) == INT8OID) \ || ((t) == INT8OID) \
|| ((t) == FLOAT8OID) \ || ((t) == FLOAT8OID) \
...@@ -85,10 +86,16 @@ typedef enum CATEGORY ...@@ -85,10 +86,16 @@ typedef enum CATEGORY
#define IS_BINARY_COMPATIBLE(a,b) \ #define IS_BINARY_COMPATIBLE(a,b) \
(((a) == BPCHAROID && (b) == TEXTOID) \ (((a) == BPCHAROID && (b) == TEXTOID) \
|| ((a) == BPCHAROID && (b) == VARCHAROID) \ || ((a) == BPCHAROID && (b) == VARCHAROID) \
|| ((a) == BPCHAROID && (b) == BYTEAOID) \
|| ((a) == VARCHAROID && (b) == TEXTOID) \ || ((a) == VARCHAROID && (b) == TEXTOID) \
|| ((a) == VARCHAROID && (b) == BPCHAROID) \ || ((a) == VARCHAROID && (b) == BPCHAROID) \
|| ((a) == VARCHAROID && (b) == BYTEAOID) \
|| ((a) == TEXTOID && (b) == BPCHAROID) \ || ((a) == TEXTOID && (b) == BPCHAROID) \
|| ((a) == TEXTOID && (b) == VARCHAROID) \ || ((a) == TEXTOID && (b) == VARCHAROID) \
|| ((a) == TEXTOID && (b) == BYTEAOID) \
|| ((a) == BYTEAOID && (b) == BPCHAROID) \
|| ((a) == BYTEAOID && (b) == VARCHAROID) \
|| ((a) == BYTEAOID && (b) == TEXTOID) \
|| ((a) == OIDOID && (b) == INT4OID) \ || ((a) == OIDOID && (b) == INT4OID) \
|| ((a) == OIDOID && (b) == REGPROCOID) \ || ((a) == OIDOID && (b) == REGPROCOID) \
|| ((a) == INT4OID && (b) == OIDOID) \ || ((a) == INT4OID && (b) == OIDOID) \
......
Markdown is supported
0% or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment