diff --git a/src/backend/parser/parse_coerce.c b/src/backend/parser/parse_coerce.c index 283fd302407cad58319afd709890304d7139e830..52ba418401daed03dd2e92346ee47f8e1fedf446 100644 --- a/src/backend/parser/parse_coerce.c +++ b/src/backend/parser/parse_coerce.c @@ -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): diff --git a/src/backend/parser/parse_target.c b/src/backend/parser/parse_target.c index be48c899ddb8d5de973aeac60aa655f22f2218a7..88a69b4c2b97a0e9497ed79df9e309a6b3029120 100644 --- a/src/backend/parser/parse_target.c +++ b/src/backend/parser/parse_target.c @@ -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 $ * *------------------------------------------------------------------------- */ @@ -56,7 +56,7 @@ transformTargetEntry(ParseState *pstate, expr = transformExpr(pstate, node, EXPR_COLUMN_FIRST); 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_mod = exprTypmod(expr); @@ -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; diff --git a/src/backend/postmaster/postmaster.c b/src/backend/postmaster/postmaster.c index abc5c5ee9952a3817c7d03f6c2ea1c6bfc371e5d..1637ee7457175e2e102ac9f3293592729e813fae 100644 --- a/src/backend/postmaster/postmaster.c +++ b/src/backend/postmaster/postmaster.c @@ -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': diff --git a/src/backend/tcop/postgres.c b/src/backend/tcop/postgres.c index e75e66b6d10d48c8f7844b299878e3a166b68694..7906546a9c308999b6a9b97e3db32e53b6db2e0c 100644 --- a/src/backend/tcop/postgres.c +++ b/src/backend/tcop/postgres.c @@ -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"); } /* diff --git a/src/backend/utils/misc/guc.c b/src/backend/utils/misc/guc.c index 54a13147382dfa3ac5d2d857abfd99976a0745ca..2030c7da370e2b1b033b12d311f3bd5409b4f638 100644 --- a/src/backend/utils/misc/guc.c +++ b/src/backend/utils/misc/guc.c @@ -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}, diff --git a/src/include/parser/parse_coerce.h b/src/include/parser/parse_coerce.h index 1f508b1eae065eef7be2c9e59744919431c2da82..f0b0607cd6c8e6b4a81c0265530fb2834d6eecd9 100644 --- a/src/include/parser/parse_coerce.h +++ b/src/include/parser/parse_coerce.h @@ -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) \