Index: src/backend/commands/copy.c =================================================================== RCS file: /cvsroot/pgsql/src/backend/commands/copy.c,v retrieving revision 1.257 diff -c -c -r1.257 copy.c *** src/backend/commands/copy.c 28 Dec 2005 03:25:32 -0000 1.257 --- src/backend/commands/copy.c 1 Feb 2006 14:05:53 -0000 *************** *** 856,861 **** --- 856,880 ---- (errcode(ERRCODE_FEATURE_NOT_SUPPORTED), errmsg("COPY delimiter must be a single character"))); + /* Disallow end-of-line characters */ + if (strchr(cstate->delim, '\r') != NULL || + strchr(cstate->delim, '\n') != NULL) + ereport(ERROR, + (errcode(ERRCODE_INVALID_PARAMETER_VALUE), + errmsg("COPY delimiter cannot be newline or carriage return"))); + + if (strchr(cstate->null_print, '\r') != NULL || + strchr(cstate->null_print, '\n') != NULL) + ereport(ERROR, + (errcode(ERRCODE_INVALID_PARAMETER_VALUE), + errmsg("COPY null cannot use newline or carriage return"))); + + /* Disallow backslash in non-CSV mode */ + if (!cstate->csv_mode && strchr(cstate->delim, '\\') != NULL) + ereport(ERROR, + (errcode(ERRCODE_INVALID_PARAMETER_VALUE), + errmsg("COPY delimiter cannot be backslash"))); + /* Check header */ if (!cstate->csv_mode && cstate->header_line) ereport(ERROR,