aboutsummaryrefslogtreecommitdiff
path: root/src
diff options
context:
space:
mode:
Diffstat (limited to 'src')
-rw-r--r--src/backend/parser/parse_func.c26
-rw-r--r--src/bin/pg_dump/pg_dump.c37
-rw-r--r--src/bin/psql/mainloop.c13
-rw-r--r--src/include/utils/nabstime.h15
4 files changed, 49 insertions, 42 deletions
diff --git a/src/backend/parser/parse_func.c b/src/backend/parser/parse_func.c
index 1f63f6bc669..610fceac639 100644
--- a/src/backend/parser/parse_func.c
+++ b/src/backend/parser/parse_func.c
@@ -7,7 +7,7 @@
*
*
* IDENTIFICATION
- * $Header: /cvsroot/pgsql/src/backend/parser/parse_func.c,v 1.66 2000/01/10 17:14:36 momjian Exp $
+ * $Header: /cvsroot/pgsql/src/backend/parser/parse_func.c,v 1.67 2000/01/24 19:34:14 petere Exp $
*
*-------------------------------------------------------------------------
*/
@@ -176,8 +176,26 @@ agg_select_candidate(Oid typeid, CandidateList candidates)
current_category;
/*
- * Look for candidates which allow coersion and have a preferred type.
- * Keep all candidates if none match.
+ * First look for exact matches or binary compatible matches.
+ * (Of course exact matches shouldn't even get here, but anyway.)
+ */
+ for (current_candidate = candidates;
+ current_candidate != NULL;
+ current_candidate = current_candidate->next)
+ {
+ current_typeid = current_candidate->args[0];
+
+ if (current_typeid == typeid
+ || IS_BINARY_COMPATIBLE(current_typeid, typeid))
+ {
+ /* we're home free */
+ return current_typeid;
+ }
+ }
+
+/*
+ * If no luck that way, look for candidates which allow coersion
+ * and have a preferred type. Keep all candidates if none match.
*/
category = TypeCategory(typeid);
ncandidates = 0;
@@ -189,7 +207,7 @@ agg_select_candidate(Oid typeid, CandidateList candidates)
current_typeid = current_candidate->args[0];
current_category = TypeCategory(current_typeid);
- if ((current_category == category)
+ if (current_category == category
&& IsPreferredType(current_category, current_typeid)
&& can_coerce_type(1, &typeid, &current_typeid))
{
diff --git a/src/bin/pg_dump/pg_dump.c b/src/bin/pg_dump/pg_dump.c
index e2ebcbcb0c8..a084fba2fc2 100644
--- a/src/bin/pg_dump/pg_dump.c
+++ b/src/bin/pg_dump/pg_dump.c
@@ -21,7 +21,7 @@
*
*
* IDENTIFICATION
- * $Header: /cvsroot/pgsql/src/bin/pg_dump/pg_dump.c,v 1.137 2000/01/19 20:08:30 petere Exp $
+ * $Header: /cvsroot/pgsql/src/bin/pg_dump/pg_dump.c,v 1.138 2000/01/24 19:34:15 petere Exp $
*
* Modifications - 6/10/96 - dave@bensoft.com - version 1.13.dhb
*
@@ -140,7 +140,7 @@ help(const char *progname)
" -h, --host <hostname> server host name\n"
" -n, --no-quotes suppress most quotes around identifiers\n"
" -N, --quotes enable most quotes around identifiers\n"
- " -O, --oids dump object ids (oids)\n"
+ " -o, --oids dump object ids (oids)\n"
" -p, --port <port> server port number\n"
" -s, --schema-only dump out only the schema, no data\n"
" -t, --table <table> dump for this table only\n"
@@ -157,7 +157,7 @@ help(const char *progname)
" -h <hostname> server host name\n"
" -n suppress most quotes around identifiers\n"
" -N enable most quotes around identifiers\n"
- " -O dump object ids (oids)\n"
+ " -o dump object ids (oids)\n"
" -p <port> server port number\n"
" -s dump out only the schema, no data\n"
" -t <table> dump for this table only\n"
@@ -557,11 +557,10 @@ main(int argc, char **argv)
{"clean", no_argument, NULL, 'c'},
{"inserts",no_argument, NULL, 'd'},
{"attribute-inserts", no_argument, NULL, 'D'},
- {"output", required_argument, NULL, '\037'}, /* see note below */
{"host", required_argument, NULL, 'h'},
{"no-quotes", no_argument, NULL, 'n'},
{"quotes", no_argument, NULL, 'N'},
- {"oids", no_argument, NULL, 'O'},
+ {"oids", no_argument, NULL, 'o'},
{"port", required_argument, NULL, 'p'},
{"schema-only", no_argument, NULL, 's'},
{"table", required_argument, NULL, 't'},
@@ -592,25 +591,15 @@ main(int argc, char **argv)
/*
* A note on options:
*
- * The standard option for specifying an output file is -o/--output.
- * The standard option for specifying an input file is -f/--file.
- * pg_dump used to use -f for specifying an output file.
- * Unfortunately, -o is already in use for oids.
- *
- * Therefore I instituted the following:
- * + The -f option is gone. Most people use > for output redirection anyway
- * so there is really not a big point in supporting output files.
- * + If you like, and can, you can use --output, but it's not documented.
- * + The preferred option for oids is now -O. -o generates a warning.
- * + In the (very far) future the -o option could be used to used for
- * specifying an output file.
- * -- petere 2000-01-17
+ * The -f option was yanked because in the rest of the world (and
+ * PostgreSQL) it specifies an *input* file. You can use the shell's
+ * output redirection to achieve the same.
*/
#ifdef HAVE_GETOPT_LONG
- while ((c = getopt_long(argc, argv, "acdDf:h:nNoOp:st:uvxzV?\037", long_options, &optindex)) != -1)
+ while ((c = getopt_long(argc, argv, "acdDf:h:nNop:st:uvxzV?", long_options, &optindex)) != -1)
#else
- while ((c = getopt(argc, argv, "acdDf:h:nNoOp:st:uvxzV?-")) != -1)
+ while ((c = getopt(argc, argv, "acdDf:h:nNop:st:uvxzV?-")) != -1)
#endif
{
switch (c)
@@ -634,9 +623,6 @@ main(int argc, char **argv)
fprintf(stderr, "%s: The -f option is obsolete. You can achieve the same by writing %s > %s.\n",
progname, progname, optarg);
exit(1);
- case '\037': /* output file name, see note above */
- filename = optarg;
- break;
case 'h': /* server host */
pghost = optarg;
break;
@@ -647,10 +633,7 @@ main(int argc, char **argv)
case 'N': /* Force double-quotes on identifiers */
force_quotes = true;
break;
- case 'o':
- fprintf(stderr, "%s: The -o option for dumping oids is deprecated. Please use -O.\n", progname);
- /* FALLTHRU */
- case 'O': /* Dump oids */
+ case 'o': /* Dump oids */
oids = true;
break;
case 'p': /* server port */
diff --git a/src/bin/psql/mainloop.c b/src/bin/psql/mainloop.c
index be8f16fdf8c..cf07b42d31f 100644
--- a/src/bin/psql/mainloop.c
+++ b/src/bin/psql/mainloop.c
@@ -1,9 +1,9 @@
/*
* psql - the PostgreSQL interactive terminal
*
- * Copyright 2000 by PostgreSQL Global Development Team
+ * Copyright 2000 by PostgreSQL Global Development Group
*
- * $Header: /cvsroot/pgsql/src/bin/psql/mainloop.c,v 1.15 2000/01/18 23:30:23 petere Exp $
+ * $Header: /cvsroot/pgsql/src/bin/psql/mainloop.c,v 1.16 2000/01/24 19:34:17 petere Exp $
*/
#include <c.h>
#include "mainloop.h"
@@ -44,12 +44,13 @@ MainLoop(FILE *source)
bool success;
char in_quote; /* == 0 for no in_quote */
- bool was_bslash; /* backslash */
bool xcomment; /* in extended comment */
int paren_level;
unsigned int query_start;
int count_eof;
const char *var;
+ bool was_bslash;
+ unsigned int bslash_count;
int i,
prevlen,
@@ -236,12 +237,16 @@ MainLoop(FILE *source)
{
/* was the previous character a backslash? */
was_bslash = (i > 0 && line[i - prevlen] == '\\');
+ if (was_bslash)
+ bslash_count++;
+ else
+ bslash_count = 0;
/* in quote? */
if (in_quote)
{
/* end of quote */
- if (line[i] == in_quote && !was_bslash)
+ if (line[i] == in_quote && bslash_count % 2 == 0)
in_quote = '\0';
}
diff --git a/src/include/utils/nabstime.h b/src/include/utils/nabstime.h
index ace0e135fde..9543f679a77 100644
--- a/src/include/utils/nabstime.h
+++ b/src/include/utils/nabstime.h
@@ -6,7 +6,7 @@
*
* Copyright (c) 1994, Regents of the University of California
*
- * $Id: nabstime.h,v 1.20 1999/05/25 16:14:56 momjian Exp $
+ * $Id: nabstime.h,v 1.21 2000/01/24 19:34:19 petere Exp $
*
*-------------------------------------------------------------------------
*/
@@ -23,13 +23,14 @@
*
* ----------------------------------------------------------------
*/
-/* The original typedefs are bogus - they assume that the system's 'time_t'
- * type is of size 32-bits. Under AlphaLinux, time_t is a long int, which
- * is 64-bits. Therefore, typedef these both as simply 'time_t', and let
- * the OS define what the size really is. -- RME 3/5/99
+/*
+ * Although time_t generally is a long int on 64 bit systems, these two
+ * types must be 4 bytes, because that's what the system assumes. They
+ * should be yanked (long) before 2038 and be replaced by timestamp and
+ * interval.
*/
-typedef time_t AbsoluteTime;
-typedef time_t RelativeTime;
+typedef int32 AbsoluteTime;
+typedef int32 RelativeTime;
typedef struct
{