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
include $(SRCDIR)/Makefile.global
-INCLUDE_OPT = -I ./ \
- -I $(SRCDIR)/ \
- -I $(SRCDIR)/include \
- -I $(SRCDIR)/port/$(PORTNAME)
+INCLUDE_OPT = -I./ \
+ -I$(SRCDIR)/ \
+ -I$(SRCDIR)/include \
+ -I$(SRCDIR)/port/$(PORTNAME)
CFLAGS += $(INCLUDE_OPT) $(CFLAGS_SL)
}
/* Lookup element type information */
- typ_tuple = SearchSysCacheTuple(TYPOID, ObjectIdGetDatum(elemtype), 0, 0, 0);
+ typ_tuple = SearchSysCacheTuple(TYPEOID, ObjectIdGetDatum(elemtype), 0, 0, 0);
if (!HeapTupleIsValid(typ_tuple))
{
elog(ERROR, "array_iterator: cache lookup failed for type %d", elemtype);
int32
array_varchareq(ArrayType *array, char *value)
{
- return array_iterator((Oid) 20, /* varchar */
+ return array_iterator((Oid) 1043, /* varchar */
(Oid) 1070, /* varchareq */
0, /* logical or */
array, (Datum) value);
int32
array_all_varchareq(ArrayType *array, char *value)
{
- return array_iterator((Oid) 20, /* varchar */
+ return array_iterator((Oid) 1043, /* varchar */
(Oid) 1070, /* varchareq */
1, /* logical and */
array, (Datum) value);
int32
array_varcharregexeq(ArrayType *array, char *value)
{
- return array_iterator((Oid) 20, /* varchar */
+ return array_iterator((Oid) 1043, /* varchar */
(Oid) 1254, /* textregexeq */
0, /* logical or */
array, (Datum) value);
int32
array_all_varcharregexeq(ArrayType *array, char *value)
{
- return array_iterator((Oid) 20, /* varchar */
+ return array_iterator((Oid) 1043, /* varchar */
(Oid) 1254, /* textregexeq */
1, /* logical and */
array, (Datum) value);
int32
array_bpchareq(ArrayType *array, char *value)
{
- return array_iterator((Oid) 20, /* bpchar */
+ return array_iterator((Oid) 1042, /* bpchar */
(Oid) 1048, /* bpchareq */
0, /* logical or */
array, (Datum) value);
int32
array_all_bpchareq(ArrayType *array, char *value)
{
- return array_iterator((Oid) 20, /* bpchar */
+ return array_iterator((Oid) 1042, /* bpchar */
(Oid) 1048, /* bpchareq */
1, /* logical and */
array, (Datum) value);
int32
array_bpcharregexeq(ArrayType *array, char *value)
{
- return array_iterator((Oid) 20, /* bpchar */
+ return array_iterator((Oid) 1042, /* bpchar */
(Oid) 1254, /* textregexeq */
0, /* logical or */
array, (Datum) value);
int32
array_all_bpcharregexeq(ArrayType *array, char *value)
{
- return array_iterator((Oid) 20, /* bpchar */
+ return array_iterator((Oid) 1042, /* bpchar */
(Oid) 1254, /* textregexeq */
1, /* logical and */
array, (Datum) value);
include $(SRCDIR)/Makefile.global
-INCLUDE_OPT = -I ./ \
- -I $(SRCDIR)/ \
- -I $(SRCDIR)/include \
- -I $(SRCDIR)/port/$(PORTNAME)
+INCLUDE_OPT = -I./ \
+ -I$(SRCDIR)/ \
+ -I$(SRCDIR)/include \
+ -I$(SRCDIR)/port/$(PORTNAME)
CFLAGS += $(INCLUDE_OPT) $(CFLAGS_SL)
*
* Copyright (C) 1999, Massimo Dal Zotto <dz@cs.unitn.it>
*
+ * Date2mjd code contributed by Reiner Dassing <dassing@wettzell.ifag.de>
+ *
* This software is distributed under the GNU General Public License
* either version 2, or (at your option) any later version.
*/
if ( (tm->tm_hour < 0) || (tm->tm_hour > 24)
|| (tm->tm_min < 0) || (tm->tm_min > 59)
|| (tm->tm_sec < 0) || (tm->tm_sec > 59)
- || (fsec < 0) )
+ || (*fsec < 0) )
return -1;
return 0;
return (date);
}
+int4
+date2mjd(DateADT val)
+{
+ int result;
+
+ result = val + JDATE_2000 - 2400000.5;
+
+ return result;
+}
+
/* end of file */
/*
include $(SRCDIR)/Makefile.global
-INCLUDE_OPT = -I ./ \
- -I $(SRCDIR)/ \
- -I $(SRCDIR)/include \
- -I $(SRCDIR)/port/$(PORTNAME)
+INCLUDE_OPT = -I./ \
+ -I$(SRCDIR)/ \
+ -I$(SRCDIR)/include \
+ -I$(SRCDIR)/port/$(PORTNAME)
CFLAGS += $(INCLUDE_OPT) $(CFLAGS_SL)
return count;
}
+#ifdef USE_ASSERT_CHECKING
int
assert_enable(int val)
{
return assertTest(val);
}
#endif
+#endif
/* end of file */
int unlisten(char *relname);
int max(int x, int y);
int min(int x, int y);
-int assert_enable(int val);
+int active_listeners(text *relname);
+#ifdef USE_ASSERT_CHECKING
+int assert_enable(int val);
#ifdef ASSERT_CHECKING_TEST
int assert_test(int val);
#endif
+#endif
-int active_listeners(text *relname);
#endif
/*
include $(SRCDIR)/Makefile.global
-INCLUDE_OPT = -I ./ \
- -I $(SRCDIR)/ \
- -I $(SRCDIR)/include \
- -I $(SRCDIR)/port/$(PORTNAME)
+INCLUDE_OPT = -I./ \
+ -I$(SRCDIR)/ \
+ -I$(SRCDIR)/include \
+ -I$(SRCDIR)/port/$(PORTNAME)
CFLAGS += $(INCLUDE_OPT) $(CFLAGS_SL)
* representation of data.
*/
-char *
-string_output(char *data, int size)
+unsigned char *
+string_output(unsigned char *data, int size)
{
register unsigned char c,
*p,
{
case '\\':
case '"':
- case '{':
- case '}':
case '\b':
case '\f':
case '\n':
case '\v':
len++;
break;
+ case '{':
+ /* Escape beginning of string, to distinguish from arrays */
+ if (p == data) {
+ len++;
+ }
+ break;
default:
if (NOTPRINTABLE(*p))
len += 3;
{
case '\\':
case '"':
- case '{':
- case '}':
*r++ = '\\';
*r++ = c;
break;
*r++ = '\\';
*r++ = 'v';
break;
+ case '{':
+ /* Escape beginning of string, to distinguish from arrays */
+ if (p == data) {
+ *r++ = '\\';
+ }
+ *r++ = c;
+ break;
default:
if (NOTPRINTABLE(c))
{
* a pointer to the new string or the header.
*/
-char *
-string_input(char *str, int size, int hdrsize, int *rtn_size)
+unsigned char *
+string_input(unsigned char *str, int size, int hdrsize, int *rtn_size)
{
register unsigned char *p,
*r;
return ((char *) result);
}
-char *
+unsigned char *
c_charout(int32 c)
{
char str[2];
* This can be used for SET, bytea, text and unknown data types
*/
-char *
+unsigned char *
c_textout(struct varlena * vlena)
{
int len = 0;
* This can be used for varchar and bpchar strings
*/
-char *
-c_varcharout(char *s)
+unsigned char *
+c_varcharout(unsigned char *s)
{
int len = 0;
#if 0
struct varlena *
-c_textin(char *str)
+c_textin(unsigned char *str)
{
struct varlena *result;
int len;
}
int32 *
-c_charin(char *str)
+c_charin(unsigned char *str)
{
return (string_input(str, 1, 0, NULL));
}
#ifndef STRING_IO_H
#define STRING_IO_H
-char *string_output(char *data, int size);
-char *string_input(char *str, int size, int hdrsize, int *rtn_size);
-char *c_charout(int32 c);
-char *c_char2out(uint16 s);
-char *c_char4out(uint32 s);
-char *c_char8out(char *s);
-char *c_char16out(char *s);
-char *c_textout(struct varlena * vlena);
-char *c_varcharout(char *s);
+unsigned char* string_output(unsigned char *data, int size);
+unsigned char* string_input(unsigned char *str, int size, int hdrsize,
+ int *rtn_size);
+unsigned char* c_charout(int32 c);
+unsigned char* c_textout(struct varlena * vlena);
+unsigned char* c_varcharout(unsigned char *s);
#if 0
-struct varlena *c_textin(char *str);
-char *c_char16in(char *str);
+struct varlena* c_textin(unsigned char *str);
+int32* c_charin(unsigned char *str)
#endif
#endif
include $(SRCDIR)/Makefile.global
-INCLUDE_OPT = -I ./ \
- -I $(SRCDIR)/ \
- -I $(SRCDIR)/include \
- -I $(SRCDIR)/port/$(PORTNAME)
+INCLUDE_OPT = -I./ \
+ -I$(SRCDIR)/ \
+ -I$(SRCDIR)/include \
+ -I$(SRCDIR)/port/$(PORTNAME)
CFLAGS += $(INCLUDE_OPT) $(CFLAGS_SL)
*
*
* 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 $
*
*-------------------------------------------------------------------------
*/
* 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;
/*
while (!done)
{
- if (QueryCancel)
+ if (QueryCancel) {
+ lineno = 0;
CancelQuery();
+ }
if (!binary)
{
if (!reading_to_eof && ntuples == tuples_read)
done = true;
}
+ lineno = 0;
pfree(values);
pfree(nulls);
pfree(index_nulls);
*
*
* 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 $
*
*-------------------------------------------------------------------------
*/
#include "storage/proc.h"
#include "tcop/tcopprot.h"
#include "utils/trace.h"
+#include "commands/copy.h"
extern int errno;
extern int sys_nerr;
* (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))
{
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')
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);
* 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);
#ifdef ELOG_TIMESTAMPS
char *tprintf_timestamp(void);
-#define TIMESTAMP_SIZE 30
+#define TIMESTAMP_SIZE 28
#else
#define TIMESTAMP_SIZE 0
#endif
\$(CC) -c \$(CFLAGS) \$<
%.o : %.xs
- \$(XSUBPP} \$(TYPEMAP) \$< > xtmp.c
+ \$(XSUBPP) \$(TYPEMAP) \$< > xtmp.c
\$(CC) -c \$(CFLAGS) -o \$@ xtmp.c