Skip to content

Commit bdb41ad

Browse files
committed
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
1 parent 0dbffa7 commit bdb41ad

File tree

6 files changed

+54
-47
lines changed

6 files changed

+54
-47
lines changed

doc/src/sgml/ref/pg_dump.sgml

Lines changed: 3 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -1,5 +1,5 @@
11
<!--
2-
$Header: /cvsroot/pgsql/doc/src/sgml/ref/pg_dump.sgml,v 1.13 2000/01/18 00:03:34 petere Exp $
2+
$Header: /cvsroot/pgsql/doc/src/sgml/ref/pg_dump.sgml,v 1.14 2000/01/24 19:34:13 petere Exp $
33
Postgres documentation
44
-->
55

@@ -27,7 +27,7 @@ pg_dump [ <replaceable class="parameter">dbname</replaceable> ]
2727
pg_dump [ -h <replaceable class="parameter">host</replaceable> ] [ -p <replaceable class="parameter">port</replaceable> ]
2828
[ -t <replaceable class="parameter">table</replaceable> ]
2929
[ -a ] [ -c ] [ -d ] [ -D ] [ -n ] [ -N ]
30-
[ -O ] [ -s ] [ -u ] [ -v ] [ -x ]
30+
[ -o ] [ -s ] [ -u ] [ -v ] [ -x ]
3131
[ <replaceable class="parameter">dbname</replaceable> ]
3232
</synopsis>
3333

@@ -115,7 +115,7 @@ pg_dump [ -h <replaceable class="parameter">host</replaceable> ] [ -p <replaceab
115115
</varlistentry>
116116

117117
<varlistentry>
118-
<term>-O</term>
118+
<term>-o</term>
119119
<listitem>
120120
<para>
121121
Dump object identifiers (<acronym>OID</acronym>s) for every table.

doc/src/sgml/ref/pg_dumpall.sgml

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -1,5 +1,5 @@
11
<!--
2-
$Header: /cvsroot/pgsql/doc/src/sgml/ref/pg_dumpall.sgml,v 1.6 2000/01/18 00:03:34 petere Exp $
2+
$Header: /cvsroot/pgsql/doc/src/sgml/ref/pg_dumpall.sgml,v 1.7 2000/01/24 19:34:13 petere Exp $
33
Postgres documentation
44
-->
55

@@ -77,7 +77,7 @@ pg_dumpall [ -h <replaceable class="parameter">host</replaceable> ] [ -p <replac
7777
</varlistentry>
7878

7979
<varlistentry>
80-
<term>-O</term>
80+
<term>-o</term>
8181
<listitem>
8282
<para>
8383
Dump object identifiers (<acronym>OID</acronym>s) for every table.

src/backend/parser/parse_func.c

Lines changed: 22 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -7,7 +7,7 @@
77
*
88
*
99
* IDENTIFICATION
10-
* $Header: /cvsroot/pgsql/src/backend/parser/parse_func.c,v 1.66 2000/01/10 17:14:36 momjian Exp $
10+
* $Header: /cvsroot/pgsql/src/backend/parser/parse_func.c,v 1.67 2000/01/24 19:34:14 petere Exp $
1111
*
1212
*-------------------------------------------------------------------------
1313
*/
@@ -176,8 +176,26 @@ agg_select_candidate(Oid typeid, CandidateList candidates)
176176
current_category;
177177

178178
/*
179-
* Look for candidates which allow coersion and have a preferred type.
180-
* Keep all candidates if none match.
179+
* First look for exact matches or binary compatible matches.
180+
* (Of course exact matches shouldn't even get here, but anyway.)
181+
*/
182+
for (current_candidate = candidates;
183+
current_candidate != NULL;
184+
current_candidate = current_candidate->next)
185+
{
186+
current_typeid = current_candidate->args[0];
187+
188+
if (current_typeid == typeid
189+
|| IS_BINARY_COMPATIBLE(current_typeid, typeid))
190+
{
191+
/* we're home free */
192+
return current_typeid;
193+
}
194+
}
195+
196+
/*
197+
* If no luck that way, look for candidates which allow coersion
198+
* and have a preferred type. Keep all candidates if none match.
181199
*/
182200
category = TypeCategory(typeid);
183201
ncandidates = 0;
@@ -189,7 +207,7 @@ agg_select_candidate(Oid typeid, CandidateList candidates)
189207
current_typeid = current_candidate->args[0];
190208
current_category = TypeCategory(current_typeid);
191209

192-
if ((current_category == category)
210+
if (current_category == category
193211
&& IsPreferredType(current_category, current_typeid)
194212
&& can_coerce_type(1, &typeid, &current_typeid))
195213
{

src/bin/pg_dump/pg_dump.c

Lines changed: 10 additions & 27 deletions
Original file line numberDiff line numberDiff line change
@@ -21,7 +21,7 @@
2121
*
2222
*
2323
* IDENTIFICATION
24-
* $Header: /cvsroot/pgsql/src/bin/pg_dump/pg_dump.c,v 1.137 2000/01/19 20:08:30 petere Exp $
24+
* $Header: /cvsroot/pgsql/src/bin/pg_dump/pg_dump.c,v 1.138 2000/01/24 19:34:15 petere Exp $
2525
*
2626
* Modifications - 6/10/96 - dave@bensoft.com - version 1.13.dhb
2727
*
@@ -140,7 +140,7 @@ help(const char *progname)
140140
" -h, --host <hostname> server host name\n"
141141
" -n, --no-quotes suppress most quotes around identifiers\n"
142142
" -N, --quotes enable most quotes around identifiers\n"
143-
" -O, --oids dump object ids (oids)\n"
143+
" -o, --oids dump object ids (oids)\n"
144144
" -p, --port <port> server port number\n"
145145
" -s, --schema-only dump out only the schema, no data\n"
146146
" -t, --table <table> dump for this table only\n"
@@ -157,7 +157,7 @@ help(const char *progname)
157157
" -h <hostname> server host name\n"
158158
" -n suppress most quotes around identifiers\n"
159159
" -N enable most quotes around identifiers\n"
160-
" -O dump object ids (oids)\n"
160+
" -o dump object ids (oids)\n"
161161
" -p <port> server port number\n"
162162
" -s dump out only the schema, no data\n"
163163
" -t <table> dump for this table only\n"
@@ -557,11 +557,10 @@ main(int argc, char **argv)
557557
{"clean", no_argument, NULL, 'c'},
558558
{"inserts",no_argument, NULL, 'd'},
559559
{"attribute-inserts", no_argument, NULL, 'D'},
560-
{"output", required_argument, NULL, '\037'}, /* see note below */
561560
{"host", required_argument, NULL, 'h'},
562561
{"no-quotes", no_argument, NULL, 'n'},
563562
{"quotes", no_argument, NULL, 'N'},
564-
{"oids", no_argument, NULL, 'O'},
563+
{"oids", no_argument, NULL, 'o'},
565564
{"port", required_argument, NULL, 'p'},
566565
{"schema-only", no_argument, NULL, 's'},
567566
{"table", required_argument, NULL, 't'},
@@ -592,25 +591,15 @@ main(int argc, char **argv)
592591
/*
593592
* A note on options:
594593
*
595-
* The standard option for specifying an output file is -o/--output.
596-
* The standard option for specifying an input file is -f/--file.
597-
* pg_dump used to use -f for specifying an output file.
598-
* Unfortunately, -o is already in use for oids.
599-
*
600-
* Therefore I instituted the following:
601-
* + The -f option is gone. Most people use > for output redirection anyway
602-
* so there is really not a big point in supporting output files.
603-
* + If you like, and can, you can use --output, but it's not documented.
604-
* + The preferred option for oids is now -O. -o generates a warning.
605-
* + In the (very far) future the -o option could be used to used for
606-
* specifying an output file.
607-
* -- petere 2000-01-17
594+
* The -f option was yanked because in the rest of the world (and
595+
* PostgreSQL) it specifies an *input* file. You can use the shell's
596+
* output redirection to achieve the same.
608597
*/
609598

610599
#ifdef HAVE_GETOPT_LONG
611-
while ((c = getopt_long(argc, argv, "acdDf:h:nNoOp:st:uvxzV?\037", long_options, &optindex)) != -1)
600+
while ((c = getopt_long(argc, argv, "acdDf:h:nNop:st:uvxzV?", long_options, &optindex)) != -1)
612601
#else
613-
while ((c = getopt(argc, argv, "acdDf:h:nNoOp:st:uvxzV?-")) != -1)
602+
while ((c = getopt(argc, argv, "acdDf:h:nNop:st:uvxzV?-")) != -1)
614603
#endif
615604
{
616605
switch (c)
@@ -634,9 +623,6 @@ main(int argc, char **argv)
634623
fprintf(stderr, "%s: The -f option is obsolete. You can achieve the same by writing %s > %s.\n",
635624
progname, progname, optarg);
636625
exit(1);
637-
case '\037': /* output file name, see note above */
638-
filename = optarg;
639-
break;
640626
case 'h': /* server host */
641627
pghost = optarg;
642628
break;
@@ -647,10 +633,7 @@ main(int argc, char **argv)
647633
case 'N': /* Force double-quotes on identifiers */
648634
force_quotes = true;
649635
break;
650-
case 'o':
651-
fprintf(stderr, "%s: The -o option for dumping oids is deprecated. Please use -O.\n", progname);
652-
/* FALLTHRU */
653-
case 'O': /* Dump oids */
636+
case 'o': /* Dump oids */
654637
oids = true;
655638
break;
656639
case 'p': /* server port */

src/bin/psql/mainloop.c

Lines changed: 9 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -1,9 +1,9 @@
11
/*
22
* psql - the PostgreSQL interactive terminal
33
*
4-
* Copyright 2000 by PostgreSQL Global Development Team
4+
* Copyright 2000 by PostgreSQL Global Development Group
55
*
6-
* $Header: /cvsroot/pgsql/src/bin/psql/mainloop.c,v 1.15 2000/01/18 23:30:23 petere Exp $
6+
* $Header: /cvsroot/pgsql/src/bin/psql/mainloop.c,v 1.16 2000/01/24 19:34:17 petere Exp $
77
*/
88
#include <c.h>
99
#include "mainloop.h"
@@ -44,12 +44,13 @@ MainLoop(FILE *source)
4444

4545
bool success;
4646
char in_quote; /* == 0 for no in_quote */
47-
bool was_bslash; /* backslash */
4847
bool xcomment; /* in extended comment */
4948
int paren_level;
5049
unsigned int query_start;
5150
int count_eof;
5251
const char *var;
52+
bool was_bslash;
53+
unsigned int bslash_count;
5354

5455
int i,
5556
prevlen,
@@ -236,12 +237,16 @@ MainLoop(FILE *source)
236237
{
237238
/* was the previous character a backslash? */
238239
was_bslash = (i > 0 && line[i - prevlen] == '\\');
240+
if (was_bslash)
241+
bslash_count++;
242+
else
243+
bslash_count = 0;
239244

240245
/* in quote? */
241246
if (in_quote)
242247
{
243248
/* end of quote */
244-
if (line[i] == in_quote && !was_bslash)
249+
if (line[i] == in_quote && bslash_count % 2 == 0)
245250
in_quote = '\0';
246251
}
247252

src/include/utils/nabstime.h

Lines changed: 8 additions & 7 deletions
Original file line numberDiff line numberDiff line change
@@ -6,7 +6,7 @@
66
*
77
* Copyright (c) 1994, Regents of the University of California
88
*
9-
* $Id: nabstime.h,v 1.20 1999/05/25 16:14:56 momjian Exp $
9+
* $Id: nabstime.h,v 1.21 2000/01/24 19:34:19 petere Exp $
1010
*
1111
*-------------------------------------------------------------------------
1212
*/
@@ -23,13 +23,14 @@
2323
*
2424
* ----------------------------------------------------------------
2525
*/
26-
/* The original typedefs are bogus - they assume that the system's 'time_t'
27-
* type is of size 32-bits. Under AlphaLinux, time_t is a long int, which
28-
* is 64-bits. Therefore, typedef these both as simply 'time_t', and let
29-
* the OS define what the size really is. -- RME 3/5/99
26+
/*
27+
* Although time_t generally is a long int on 64 bit systems, these two
28+
* types must be 4 bytes, because that's what the system assumes. They
29+
* should be yanked (long) before 2038 and be replaced by timestamp and
30+
* interval.
3031
*/
31-
typedef time_t AbsoluteTime;
32-
typedef time_t RelativeTime;
32+
typedef int32 AbsoluteTime;
33+
typedef int32 RelativeTime;
3334

3435
typedef struct
3536
{

0 commit comments

Comments
 (0)
pFad - Phonifier reborn

Pfad - The Proxy pFad of © 2024 Garber Painting. All rights reserved.

Note: This service is not intended for secure transactions such as banking, social media, email, or purchasing. Use at your own risk. We assume no liability whatsoever for broken pages.


Alternative Proxies:

Alternative Proxy

pFad Proxy

pFad v3 Proxy

pFad v4 Proxy