Made abstime/reltime use int4 instead of time_t (TODO item)
authorPeter Eisentraut
Mon, 24 Jan 2000 19:34:19 +0000 (19:34 +0000)
committerPeter Eisentraut
Mon, 24 Jan 2000 19:34:19 +0000 (19:34 +0000)
Made type equivalency apply to aggregates (TODO item)
Fixed parsing bug in psql
Reverted some stupid options changes I made to pg_dump

doc/src/sgml/ref/pg_dump.sgml
doc/src/sgml/ref/pg_dumpall.sgml
src/backend/parser/parse_func.c
src/bin/pg_dump/pg_dump.c
src/bin/psql/mainloop.c
src/include/utils/nabstime.h

index d8f6bb6b57e286f9108f854b884d2cf68d4c6026..b6a0f0ea7e3b522fccd66c63ad7289d458b804a4 100644 (file)
@@ -1,5 +1,5 @@
 
 
@@ -27,7 +27,7 @@ pg_dump [ dbname ]
 pg_dump [ -h host ] [ -p port ]
     [ -t table ]
     [ -a ] [ -c ] [ -d ] [ -D ] [ -n ] [ -N ]
-    [ -O ] [ -s ] [ -u ] [ -v ] [ -x ]
+    [ -o ] [ -s ] [ -u ] [ -v ] [ -x ]
     [ dbname ]
   
 
@@ -115,7 +115,7 @@ pg_dump [ -h host ] [ -p 
      
 
      
-      -O
+      -o
       
        
    Dump object identifiers (OIDs) for every table.
index cfe3b62f7f36a72d8cc226933e4fcfcdaec9ba99..bde5bb40a9c0201e9688cb9440e749cbd8ba4c71 100644 (file)
@@ -1,5 +1,5 @@
 
 
@@ -77,7 +77,7 @@ pg_dumpall [ -h host ] [ -p 
      
 
      
-      -O
+      -o
       
        
    Dump object identifiers (OIDs) for every table.
index 1f63f6bc669a5c0c13bd5e6b74ebc2001ad986f4..610fceac639141b0bb9eb661aa4b43fdbfd63ccc 100644 (file)
@@ -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, ¤t_typeid))
        {
index e2ebcbcb0c87bf8295cab5df419c2db9ace5a443..a084fba2fc2c1fbe9ac76f876bb8e80aa5fd0a1a 100644 (file)
@@ -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 - [email protected] - version 1.13.dhb
  *
@@ -140,7 +140,7 @@ help(const char *progname)
         "  -h, --host     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         server port number\n"
         "  -s, --schema-only        dump out only the schema, no data\n"
         "  -t, --table       dump for this table only\n"
@@ -157,7 +157,7 @@ help(const char *progname)
         "  -h             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                 server port number\n"
         "  -s                       dump out only the schema, no data\n"
         "  -t 
               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 */
index be8f16fdf8cb89c2c18034d9a6e8db7ff28a8ddc..cf07b42d31fcfe1084068b745c5ba17a2ece4183 100644 (file)
@@ -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 
 #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';
            }
 
index ace0e135fdec8f65746ded0fd46b24568a82bf95..9543f679a77503fb9f5b5ca3922c71402b3112fa 100644 (file)
@@ -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 $
  *
  *-------------------------------------------------------------------------
  */
  *
  * ----------------------------------------------------------------
  */
-/* 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
 {