diff options
author | Bruce Momjian <bruce@momjian.us> | 2000-02-13 18:59:53 +0000 |
---|---|---|
committer | Bruce Momjian <bruce@momjian.us> | 2000-02-13 18:59:53 +0000 |
commit | a2226ad2373dcea5063fb8dafee1d52487be15cd (patch) | |
tree | 1b69a17c51bb0338af72f7a19f9ebee05cf11af6 /src | |
parent | 77d31cf3c17070c38b6536fc8b8f264525930cda (diff) | |
download | postgresql-a2226ad2373dcea5063fb8dafee1d52487be15cd.tar.gz postgresql-a2226ad2373dcea5063fb8dafee1d52487be15cd.zip |
contrib-array.patch
this is an old patch which I have already submitted and never seen
in the sources. It corrects the datatype oids used in some iterator
functions. This bug has been reported to me by many other people.
contrib-datetime.patch
some code contributed by Reiner Dassing <dassing@wettzell.ifag.de>
contrib-makefiles.patch
fixes all my contrib makefiles which don't work with some compilers,
as reported to me by another user.
contrib-miscutil.patch
an old patch for one of my old contribs.
contrib-string.patch
a small change to the c-like text output functions. Now the '{'
is escaped only at the beginning of the string to distinguish it
from arrays, and the '}' is no more escaped.
elog-lineno.patch
adds the current lineno of CopyFrom to elog messages. This is very
useful when you load a 1 million tuples table from an external file
and there is a bad value somehere. Currently you get an error message
but you can't know where is the bad data. The patch uses a variable
which was declared static in copy.c. The variable is now exported
and initialized to 0. It is always cleared at the end of the copy
or at the first elog message or when the copy is canceled.
I know this is very ugly but I can't find any better way of knowing
where the copy fails and I have this problem quite often.
plperl-makefile.patch
fixes a typo in a makefile, but the error must be elsewhere because
it is a file generated automatically. Please have a look.
tprintf-timestamp.patch
restores the original 2-digit year format, assuming that the two
century digits don't carry much information and that '000202' is
easier to read than 20000202. Being only a log file it shouldn't
break anything.
Please apply the patches before the next scheduled code freeze.
I also noticed that some of the contribs don't compile correcly. Should we
ask people to fix their code or rename their makefiles so that they are
ignored by the top makefile?
--
Massimo Dal Zotto
Diffstat (limited to 'src')
-rw-r--r-- | src/backend/commands/copy.c | 9 | ||||
-rw-r--r-- | src/backend/utils/error/elog.c | 13 | ||||
-rw-r--r-- | src/backend/utils/misc/trace.c | 4 | ||||
-rw-r--r-- | src/include/commands/copy.h | 3 | ||||
-rw-r--r-- | src/include/utils/trace.h | 2 | ||||
-rw-r--r-- | src/pl/plperl/Makefile.PL | 2 |
6 files changed, 23 insertions, 10 deletions
diff --git a/src/backend/commands/copy.c b/src/backend/commands/copy.c index 7a23a063aaf..85a50c10398 100644 --- a/src/backend/commands/copy.c +++ b/src/backend/commands/copy.c @@ -7,7 +7,7 @@ * * * IDENTIFICATION - * $Header: /cvsroot/pgsql/src/backend/commands/copy.c,v 1.100 2000/02/09 00:10:11 tgl Exp $ + * $Header: /cvsroot/pgsql/src/backend/commands/copy.c,v 1.101 2000/02/13 18:59:50 momjian Exp $ * *------------------------------------------------------------------------- */ @@ -64,7 +64,7 @@ static int CountTuples(Relation relation); * Static communication variables ... pretty grotty, but COPY has * never been reentrant... */ -static int lineno; +int lineno = 0; /* used by elog() -- dz */ static bool fe_eof; /* @@ -726,8 +726,10 @@ CopyFrom(Relation rel, bool binary, bool oids, FILE *fp, char *delim, char *null while (!done) { - if (QueryCancel) + if (QueryCancel) { + lineno = 0; CancelQuery(); + } if (!binary) { @@ -931,6 +933,7 @@ CopyFrom(Relation rel, bool binary, bool oids, FILE *fp, char *delim, char *null if (!reading_to_eof && ntuples == tuples_read) done = true; } + lineno = 0; pfree(values); pfree(nulls); pfree(index_nulls); diff --git a/src/backend/utils/error/elog.c b/src/backend/utils/error/elog.c index 71fd9c8354f..1a61d7e6d17 100644 --- a/src/backend/utils/error/elog.c +++ b/src/backend/utils/error/elog.c @@ -8,7 +8,7 @@ * * * IDENTIFICATION - * $Header: /cvsroot/pgsql/src/backend/utils/error/elog.c,v 1.54 2000/01/26 05:57:20 momjian Exp $ + * $Header: /cvsroot/pgsql/src/backend/utils/error/elog.c,v 1.55 2000/02/13 18:59:50 momjian Exp $ * *------------------------------------------------------------------------- */ @@ -35,6 +35,7 @@ #include "storage/proc.h" #include "tcop/tcopprot.h" #include "utils/trace.h" +#include "commands/copy.h" extern int errno; extern int sys_nerr; @@ -164,7 +165,7 @@ elog(int lev, const char *fmt, ...) * (since vsnprintf won't know what to do with %m). To keep * space calculation simple, we only allow one %m. */ - space_needed = TIMESTAMP_SIZE + strlen(prefix) + indent + space_needed = TIMESTAMP_SIZE + strlen(prefix) + indent + (lineno ? 24 : 0) + strlen(fmt) + strlen(errorstr) + 1; if (space_needed > (int) sizeof(fmt_fixedbuf)) { @@ -186,6 +187,14 @@ elog(int lev, const char *fmt, ...) bp = fmt_buf + strlen(fmt_buf); while (indent-- > 0) *bp++ = ' '; + + /* If error was in CopyFrom() print the offending line number -- dz */ + if (lineno) { + sprintf(bp, "copy: line %d, ", lineno); + bp = fmt_buf + strlen(fmt_buf); + lineno = 0; + } + for (cp = fmt; *cp; cp++) { if (cp[0] == '%' && cp[1] != '\0') diff --git a/src/backend/utils/misc/trace.c b/src/backend/utils/misc/trace.c index 044afe16519..33ca0ce0a6b 100644 --- a/src/backend/utils/misc/trace.c +++ b/src/backend/utils/misc/trace.c @@ -233,8 +233,8 @@ tprintf_timestamp() time = localtime(&tm); sprintf(pid, "[%d]", MyProcPid); - sprintf(timestamp, "%04d%02d%02d.%02d:%02d:%02d.%03d %7s ", - time->tm_year+1900, time->tm_mon + 1, time->tm_mday, + sprintf(timestamp, "%02d%02d%02d.%02d:%02d:%02d.%03d %7s ", + time->tm_year % 100, time->tm_mon + 1, time->tm_mday, time->tm_hour, time->tm_min, time->tm_sec, (int) (tv.tv_usec/1000), pid); diff --git a/src/include/commands/copy.h b/src/include/commands/copy.h index 6f8c79676a2..ecdb9bbb4e8 100644 --- a/src/include/commands/copy.h +++ b/src/include/commands/copy.h @@ -7,13 +7,14 @@ * Portions Copyright (c) 1996-2000, PostgreSQL, Inc * Portions Copyright (c) 1994, Regents of the University of California * - * $Id: copy.h,v 1.9 2000/01/26 05:58:00 momjian Exp $ + * $Id: copy.h,v 1.10 2000/02/13 18:59:52 momjian Exp $ * *------------------------------------------------------------------------- */ #ifndef COPY_H #define COPY_H +extern int lineno; void DoCopy(char *relname, bool binary, bool oids, bool from, bool pipe, char *filename, char *delim, char *null_print); diff --git a/src/include/utils/trace.h b/src/include/utils/trace.h index 61f0b27da13..3cb2d9e28f1 100644 --- a/src/include/utils/trace.h +++ b/src/include/utils/trace.h @@ -18,7 +18,7 @@ #ifdef ELOG_TIMESTAMPS char *tprintf_timestamp(void); -#define TIMESTAMP_SIZE 30 +#define TIMESTAMP_SIZE 28 #else #define TIMESTAMP_SIZE 0 #endif diff --git a/src/pl/plperl/Makefile.PL b/src/pl/plperl/Makefile.PL index 43773debb5e..9285668917b 100644 --- a/src/pl/plperl/Makefile.PL +++ b/src/pl/plperl/Makefile.PL @@ -107,7 +107,7 @@ plperl : plperl.o SPI.o \$(CC) -c \$(CFLAGS) \$< %.o : %.xs - \$(XSUBPP} \$(TYPEMAP) \$< > xtmp.c + \$(XSUBPP) \$(TYPEMAP) \$< > xtmp.c \$(CC) -c \$(CFLAGS) -o \$@ xtmp.c |