Commit bdb41ad0 authored by Peter Eisentraut's avatar Peter Eisentraut

Made abstime/reltime use int4 instead of time_t (TODO item)

Made type equivalency apply to aggregates (TODO item)
Fixed parsing bug in psql
Reverted some stupid options changes I made to pg_dump
parent 0dbffa70
<!-- <!--
$Header: /cvsroot/pgsql/doc/src/sgml/ref/pg_dump.sgml,v 1.13 2000/01/18 00:03:34 petere Exp $ $Header: /cvsroot/pgsql/doc/src/sgml/ref/pg_dump.sgml,v 1.14 2000/01/24 19:34:13 petere Exp $
Postgres documentation Postgres documentation
--> -->
...@@ -27,7 +27,7 @@ pg_dump [ <replaceable class="parameter">dbname</replaceable> ] ...@@ -27,7 +27,7 @@ pg_dump [ <replaceable class="parameter">dbname</replaceable> ]
pg_dump [ -h <replaceable class="parameter">host</replaceable> ] [ -p <replaceable class="parameter">port</replaceable> ] pg_dump [ -h <replaceable class="parameter">host</replaceable> ] [ -p <replaceable class="parameter">port</replaceable> ]
[ -t <replaceable class="parameter">table</replaceable> ] [ -t <replaceable class="parameter">table</replaceable> ]
[ -a ] [ -c ] [ -d ] [ -D ] [ -n ] [ -N ] [ -a ] [ -c ] [ -d ] [ -D ] [ -n ] [ -N ]
[ -O ] [ -s ] [ -u ] [ -v ] [ -x ] [ -o ] [ -s ] [ -u ] [ -v ] [ -x ]
[ <replaceable class="parameter">dbname</replaceable> ] [ <replaceable class="parameter">dbname</replaceable> ]
</synopsis> </synopsis>
...@@ -115,7 +115,7 @@ pg_dump [ -h <replaceable class="parameter">host</replaceable> ] [ -p <replaceab ...@@ -115,7 +115,7 @@ pg_dump [ -h <replaceable class="parameter">host</replaceable> ] [ -p <replaceab
</varlistentry> </varlistentry>
<varlistentry> <varlistentry>
<term>-O</term> <term>-o</term>
<listitem> <listitem>
<para> <para>
Dump object identifiers (<acronym>OID</acronym>s) for every table. Dump object identifiers (<acronym>OID</acronym>s) for every table.
......
<!-- <!--
$Header: /cvsroot/pgsql/doc/src/sgml/ref/pg_dumpall.sgml,v 1.6 2000/01/18 00:03:34 petere Exp $ $Header: /cvsroot/pgsql/doc/src/sgml/ref/pg_dumpall.sgml,v 1.7 2000/01/24 19:34:13 petere Exp $
Postgres documentation Postgres documentation
--> -->
...@@ -77,7 +77,7 @@ pg_dumpall [ -h <replaceable class="parameter">host</replaceable> ] [ -p <replac ...@@ -77,7 +77,7 @@ pg_dumpall [ -h <replaceable class="parameter">host</replaceable> ] [ -p <replac
</varlistentry> </varlistentry>
<varlistentry> <varlistentry>
<term>-O</term> <term>-o</term>
<listitem> <listitem>
<para> <para>
Dump object identifiers (<acronym>OID</acronym>s) for every table. Dump object identifiers (<acronym>OID</acronym>s) for every table.
......
...@@ -7,7 +7,7 @@ ...@@ -7,7 +7,7 @@
* *
* *
* IDENTIFICATION * 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) ...@@ -176,8 +176,26 @@ agg_select_candidate(Oid typeid, CandidateList candidates)
current_category; current_category;
/* /*
* Look for candidates which allow coersion and have a preferred type. * First look for exact matches or binary compatible matches.
* Keep all candidates if none match. * (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); category = TypeCategory(typeid);
ncandidates = 0; ncandidates = 0;
...@@ -189,7 +207,7 @@ agg_select_candidate(Oid typeid, CandidateList candidates) ...@@ -189,7 +207,7 @@ agg_select_candidate(Oid typeid, CandidateList candidates)
current_typeid = current_candidate->args[0]; current_typeid = current_candidate->args[0];
current_category = TypeCategory(current_typeid); current_category = TypeCategory(current_typeid);
if ((current_category == category) if (current_category == category
&& IsPreferredType(current_category, current_typeid) && IsPreferredType(current_category, current_typeid)
&& can_coerce_type(1, &typeid, &current_typeid)) && can_coerce_type(1, &typeid, &current_typeid))
{ {
......
...@@ -21,7 +21,7 @@ ...@@ -21,7 +21,7 @@
* *
* *
* IDENTIFICATION * 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 * Modifications - 6/10/96 - dave@bensoft.com - version 1.13.dhb
* *
...@@ -140,7 +140,7 @@ help(const char *progname) ...@@ -140,7 +140,7 @@ help(const char *progname)
" -h, --host <hostname> server host name\n" " -h, --host <hostname> server host name\n"
" -n, --no-quotes suppress most quotes around identifiers\n" " -n, --no-quotes suppress most quotes around identifiers\n"
" -N, --quotes enable 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" " -p, --port <port> server port number\n"
" -s, --schema-only dump out only the schema, no data\n" " -s, --schema-only dump out only the schema, no data\n"
" -t, --table <table> dump for this table only\n" " -t, --table <table> dump for this table only\n"
...@@ -157,7 +157,7 @@ help(const char *progname) ...@@ -157,7 +157,7 @@ help(const char *progname)
" -h <hostname> server host name\n" " -h <hostname> server host name\n"
" -n suppress most quotes around identifiers\n" " -n suppress most quotes around identifiers\n"
" -N enable 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" " -p <port> server port number\n"
" -s dump out only the schema, no data\n" " -s dump out only the schema, no data\n"
" -t <table> dump for this table only\n" " -t <table> dump for this table only\n"
...@@ -557,11 +557,10 @@ main(int argc, char **argv) ...@@ -557,11 +557,10 @@ main(int argc, char **argv)
{"clean", no_argument, NULL, 'c'}, {"clean", no_argument, NULL, 'c'},
{"inserts",no_argument, NULL, 'd'}, {"inserts",no_argument, NULL, 'd'},
{"attribute-inserts", no_argument, NULL, 'D'}, {"attribute-inserts", no_argument, NULL, 'D'},
{"output", required_argument, NULL, '\037'}, /* see note below */
{"host", required_argument, NULL, 'h'}, {"host", required_argument, NULL, 'h'},
{"no-quotes", no_argument, NULL, 'n'}, {"no-quotes", no_argument, NULL, 'n'},
{"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'}, {"port", required_argument, NULL, 'p'},
{"schema-only", no_argument, NULL, 's'}, {"schema-only", no_argument, NULL, 's'},
{"table", required_argument, NULL, 't'}, {"table", required_argument, NULL, 't'},
...@@ -592,25 +591,15 @@ main(int argc, char **argv) ...@@ -592,25 +591,15 @@ main(int argc, char **argv)
/* /*
* A note on options: * A note on options:
* *
* The standard option for specifying an output file is -o/--output. * The -f option was yanked because in the rest of the world (and
* The standard option for specifying an input file is -f/--file. * PostgreSQL) it specifies an *input* file. You can use the shell's
* pg_dump used to use -f for specifying an output file. * output redirection to achieve the same.
* 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
*/ */
#ifdef HAVE_GETOPT_LONG #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 #else
while ((c = getopt(argc, argv, "acdDf:h:nNoOp:st:uvxzV?-")) != -1) while ((c = getopt(argc, argv, "acdDf:h:nNop:st:uvxzV?-")) != -1)
#endif #endif
{ {
switch (c) switch (c)
...@@ -634,9 +623,6 @@ main(int argc, char **argv) ...@@ -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", fprintf(stderr, "%s: The -f option is obsolete. You can achieve the same by writing %s > %s.\n",
progname, progname, optarg); progname, progname, optarg);
exit(1); exit(1);
case '\037': /* output file name, see note above */
filename = optarg;
break;
case 'h': /* server host */ case 'h': /* server host */
pghost = optarg; pghost = optarg;
break; break;
...@@ -647,10 +633,7 @@ main(int argc, char **argv) ...@@ -647,10 +633,7 @@ main(int argc, char **argv)
case 'N': /* Force double-quotes on identifiers */ case 'N': /* Force double-quotes on identifiers */
force_quotes = true; force_quotes = true;
break; break;
case 'o': case 'o': /* Dump oids */
fprintf(stderr, "%s: The -o option for dumping oids is deprecated. Please use -O.\n", progname);
/* FALLTHRU */
case 'O': /* Dump oids */
oids = true; oids = true;
break; break;
case 'p': /* server port */ case 'p': /* server port */
......
/* /*
* psql - the PostgreSQL interactive terminal * 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 <c.h>
#include "mainloop.h" #include "mainloop.h"
...@@ -44,12 +44,13 @@ MainLoop(FILE *source) ...@@ -44,12 +44,13 @@ MainLoop(FILE *source)
bool success; bool success;
char in_quote; /* == 0 for no in_quote */ char in_quote; /* == 0 for no in_quote */
bool was_bslash; /* backslash */
bool xcomment; /* in extended comment */ bool xcomment; /* in extended comment */
int paren_level; int paren_level;
unsigned int query_start; unsigned int query_start;
int count_eof; int count_eof;
const char *var; const char *var;
bool was_bslash;
unsigned int bslash_count;
int i, int i,
prevlen, prevlen,
...@@ -236,12 +237,16 @@ MainLoop(FILE *source) ...@@ -236,12 +237,16 @@ MainLoop(FILE *source)
{ {
/* was the previous character a backslash? */ /* was the previous character a backslash? */
was_bslash = (i > 0 && line[i - prevlen] == '\\'); was_bslash = (i > 0 && line[i - prevlen] == '\\');
if (was_bslash)
bslash_count++;
else
bslash_count = 0;
/* in quote? */ /* in quote? */
if (in_quote) if (in_quote)
{ {
/* end of quote */ /* end of quote */
if (line[i] == in_quote && !was_bslash) if (line[i] == in_quote && bslash_count % 2 == 0)
in_quote = '\0'; in_quote = '\0';
} }
......
...@@ -6,7 +6,7 @@ ...@@ -6,7 +6,7 @@
* *
* Copyright (c) 1994, Regents of the University of California * 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 @@ ...@@ -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 * Although time_t generally is a long int on 64 bit systems, these two
* is 64-bits. Therefore, typedef these both as simply 'time_t', and let * types must be 4 bytes, because that's what the system assumes. They
* the OS define what the size really is. -- RME 3/5/99 * should be yanked (long) before 2038 and be replaced by timestamp and
* interval.
*/ */
typedef time_t AbsoluteTime; typedef int32 AbsoluteTime;
typedef time_t RelativeTime; typedef int32 RelativeTime;
typedef struct typedef struct
{ {
......
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