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 @@
*
*
* 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)
case (CHAROID):
case (NAMEOID):
case (BYTEAOID):
case (BPCHAROID):
case (VARCHAROID):
case (TEXTOID):
......@@ -614,6 +615,7 @@ PromoteTypeToNext(Oid inType)
result = VARCHAROID;
break;
case (BYTEAOID):
case (VARCHAROID):
result = TEXTOID;
break;
......@@ -708,6 +710,7 @@ PromoteLesserType(Oid inType1, Oid inType2, Oid *newType1, Oid *newType2)
case (CHAROID):
switch (*arg2)
{
case (BYTEAOID):
case (BPCHAROID):
case (VARCHAROID):
case (TEXTOID):
......@@ -772,6 +775,7 @@ PromoteLesserType(Oid inType1, Oid inType2, Oid *newType1, Oid *newType2)
case (CHAROID):
switch (*arg2)
{
case (BYTEAOID):
case (BPCHAROID):
case (VARCHAROID):
case (TEXTOID):
......
......@@ -8,7 +8,7 @@
*
*
* 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 $
*
*-------------------------------------------------------------------------
*/
......@@ -311,7 +311,9 @@ CoerceTargetExpr(ParseState *pstate,
* string hacks to get transparent conversions w/o explicit
* conversions
*/
else if ((attrtype == BPCHAROID) || (attrtype == VARCHAROID))
else if (attrtype == BPCHAROID ||
attrtype == VARCHAROID ||
attrtype == BYTEAOID)
{
Oid text_id = TEXTOID;
......
......@@ -37,7 +37,7 @@
*
*
* 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
*
......@@ -431,14 +431,14 @@ PostmasterMain(int argc, char *argv[])
#ifndef USE_ASSERT_CHECKING
postmaster_error("Assert checking is not compiled in.");
#else
assert_enabled = atoi(optarg);
SetConfigOption("debug_assertions", optarg, PGC_POSTMASTER, true);
#endif
break;
case 'a':
/* Can no longer set authentication method. */
break;
case 'B':
NBuffers = atoi(optarg);
SetConfigOption("shared_buffers", optarg, PGC_POSTMASTER, true);
break;
case 'b':
/* Can no longer set the backend executable file to use. */
......@@ -452,23 +452,23 @@ PostmasterMain(int argc, char *argv[])
* Turn on debugging for the postmaster and the backend
* servers descended from it.
*/
DebugLvl = atoi(optarg);
SetConfigOption("debug_level", optarg, PGC_POSTMASTER, true);
break;
case 'F':
enableFsync = false;
SetConfigOption("enable_fsync", "false", PGC_POSTMASTER, true);
break;
case 'h':
VirtualHost = optarg;
SetConfigOption("virtual_host", optarg, PGC_POSTMASTER, true);
break;
case 'i':
NetServer = true;
SetConfigOption("tcpip_socket", "true", PGC_POSTMASTER, true);
break;
case 'k':
UnixSocketDir = optarg;
SetConfigOption("unix_socket_directory", optarg, PGC_POSTMASTER, true);
break;
#ifdef USE_SSL
case 'l':
EnableSSL = true;
SetConfigOption("ssl", "true", PGC_POSTMASTER, true);
break;
#endif
case 'm':
......@@ -488,11 +488,7 @@ PostmasterMain(int argc, char *argv[])
* The max number of backends to start. Can't set to less
* than 1 or more than compiled-in limit.
*/
MaxBackends = atoi(optarg);
if (MaxBackends < 1)
MaxBackends = 1;
if (MaxBackends > MAXBACKENDS)
MaxBackends = MAXBACKENDS;
SetConfigOption("max_connections", optarg, PGC_POSTMASTER, true);
break;
case 'n':
/* Don't reinit shared mem after abnormal exit */
......@@ -509,7 +505,7 @@ PostmasterMain(int argc, char *argv[])
strcpy(original_extraoptions, optarg);
break;
case 'p':
PostPortNumber = atoi(optarg);
SetConfigOption("port", optarg, PGC_POSTMASTER, true);
break;
case 'S':
......@@ -519,7 +515,7 @@ PostmasterMain(int argc, char *argv[])
* it's most badly needed on SysV-derived systems like
* SVR4 and HP-UX.
*/
SilentMode = true;
SetConfigOption("silent_mode", "true", PGC_POSTMASTER, true);
break;
case 's':
......
......@@ -8,7 +8,7 @@
*
*
* 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
* 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
const char *DBName = NULL;
bool secure = true;
int errs = 0;
GucContext ctx;
char *tmp;
int firstchar;
StringInfo parser_input;
......@@ -1119,6 +1121,9 @@ PostgresMain(int argc, char *argv[], int real_argc, char *real_argv[], const cha
char *potential_DataDir = NULL;
/* all options are allowed until '-p' */
ctx = PGC_POSTMASTER;
/*
* Catch standard options before doing much else. This even works on
* systems without getopt_long.
......@@ -1192,7 +1197,7 @@ PostgresMain(int argc, char *argv[], int real_argc, char *real_argv[], const cha
{
case 'A':
#ifdef USE_ASSERT_CHECKING
assert_enabled = atoi(optarg);
SetConfigOption("debug_assertions", optarg, ctx, true);
#else
fprintf(stderr, "Assert checking is not compiled in\n");
#endif
......@@ -1203,8 +1208,7 @@ PostgresMain(int argc, char *argv[], int real_argc, char *real_argv[], const cha
/*
* specify the size of buffer pool
*/
if (secure)
NBuffers = atoi(optarg);
SetConfigOption("shared_buffers", optarg, ctx, true);
break;
case 'C':
......@@ -1221,17 +1225,18 @@ PostgresMain(int argc, char *argv[], int real_argc, char *real_argv[], const cha
break;
case 'd': /* debug level */
DebugLvl = atoi(optarg);
if (DebugLvl >= 1);
Log_connections = true;
tmp = "true";
SetConfigOption("debug_level", optarg, ctx, true);
if (DebugLvl >= 1)
SetConfigOption("log_connections", tmp, ctx, true);
if (DebugLvl >= 2)
Debug_print_query = true;
SetConfigOption("debug_print_query", tmp, ctx, true);
if (DebugLvl >= 3)
Debug_print_parse = true;
SetConfigOption("debug_print_parse", tmp, ctx, true);
if (DebugLvl >= 4)
Debug_print_plan = true;
SetConfigOption("debug_print_plan", tmp, ctx, true);
if (DebugLvl >= 5)
Debug_print_rewritten = true;
SetConfigOption("debug_print_rewritten", tmp, ctx, true);
break;
case 'E':
......@@ -1255,8 +1260,7 @@ PostgresMain(int argc, char *argv[], int real_argc, char *real_argv[], const cha
/*
* turn off fsync
*/
if (secure)
enableFsync = false;
SetConfigOption("fsync", "false", ctx, true);
break;
case 'f':
......@@ -1264,29 +1268,32 @@ PostgresMain(int argc, char *argv[], int real_argc, char *real_argv[], const cha
/*
* f - forbid generation of certain plans
*/
tmp = NULL;
switch (optarg[0])
{
case 's': /* seqscan */
enable_seqscan = false;
tmp = "enable_seqscan";
break;
case 'i': /* indexscan */
enable_indexscan = false;
tmp = "enable_indexscan";
break;
case 't': /* tidscan */
enable_tidscan = false;
tmp = "enable_tidscan";
break;
case 'n': /* nestloop */
enable_nestloop = false;
tmp = "enable_nestloop";
break;
case 'm': /* mergejoin */
enable_mergejoin = false;
tmp = "enable_mergejoin";
break;
case 'h': /* hashjoin */
enable_hashjoin = false;
tmp = "enable_hashjoin";
break;
default:
errs++;
}
if (tmp)
SetConfigOption(tmp, "false", ctx, true);
break;
case 'i':
......@@ -1348,6 +1355,7 @@ PostgresMain(int argc, char *argv[], int real_argc, char *real_argv[], const cha
DBName = strdup(optarg);
secure = false; /* subsequent switches are NOT
* secure */
ctx = PGC_BACKEND;
}
break;
......@@ -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
*/
{
int S;
S = atoi(optarg);
if (S >= 4 * BLCKSZ / 1024)
SortMem = S;
}
SetConfigOption("sort_mem", optarg, ctx, true);
break;
case 's':
......@@ -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
*/
Show_query_stats = 1;
SetConfigOption("show_query_stats", "true", ctx, true);
break;
case 't':
......@@ -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.
* ----------------
*/
tmp = NULL;
switch (optarg[0])
{
case 'p':
if (optarg[1] == 'a')
Show_parser_stats = 1;
tmp = "show_parser_stats";
else if (optarg[1] == 'l')
Show_planner_stats = 1;
tmp = "show_planner_stats";
else
errs++;
break;
case 'e':
Show_executor_stats = 1;
tmp = "show_parser_stats";
break;
default:
errs++;
break;
}
if (tmp)
SetConfigOption(tmp, "true", ctx, true);
break;
case 'v':
......@@ -1464,9 +1469,7 @@ PostgresMain(int argc, char *argv[], int real_argc, char *real_argv[], const cha
elog(ERROR, "-c %s requires argument", optarg);
}
/* all options are allowed if not under postmaster */
SetConfigOption(name, value,
(IsUnderPostmaster) ? PGC_BACKEND : PGC_POSTMASTER, true);
SetConfigOption(name, value, ctx, true);
free(name);
if (value)
free(value);
......@@ -1711,7 +1714,7 @@ PostgresMain(int argc, char *argv[], int real_argc, char *real_argv[], const cha
if (!IsUnderPostmaster)
{
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 @@
* Support for grand unified configuration scheme, including SET
* 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
* Written by Peter Eisentraut <peter_e@gmx.net>.
......@@ -196,7 +196,7 @@ static struct config_bool
{"fsync", PGC_SIGHUP, &enableFsync, true, 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_pid", PGC_SIGHUP, &Log_pid, false, NULL},
......@@ -276,7 +276,7 @@ static struct config_int
DEF_PGPORT, 1, 65535, NULL, NULL},
{"sort_mem", PGC_USERSET, &SortMem,
512, 1, INT_MAX, NULL, NULL},
512, 4*BLCKSZ/1024, INT_MAX, NULL, NULL},
{"debug_level", PGC_USERSET, &DebugLvl,
0, 0, 16, NULL, NULL},
......
......@@ -7,7 +7,7 @@
* Portions Copyright (c) 1996-2001, PostgreSQL Global Development Group
* 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
|| ((t) == BPCHAROID) \
|| ((t) == VARCHAROID) \
|| ((t) == TEXTOID) \
|| ((t) == BYTEAOID) \
|| ((t) == INT4OID) \
|| ((t) == INT8OID) \
|| ((t) == FLOAT8OID) \
......@@ -85,10 +86,16 @@ typedef enum CATEGORY
#define IS_BINARY_COMPATIBLE(a,b) \
(((a) == BPCHAROID && (b) == TEXTOID) \
|| ((a) == BPCHAROID && (b) == VARCHAROID) \
|| ((a) == BPCHAROID && (b) == BYTEAOID) \
|| ((a) == VARCHAROID && (b) == TEXTOID) \
|| ((a) == VARCHAROID && (b) == BPCHAROID) \
|| ((a) == VARCHAROID && (b) == BYTEAOID) \
|| ((a) == TEXTOID && (b) == BPCHAROID) \
|| ((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) == REGPROCOID) \
|| ((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