summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorAndrew Dunstan2007-12-30 14:46:52 +0000
committerAndrew Dunstan2007-12-30 14:46:52 +0000
commit7284dfe42cb40f89a92eee61b260075d0a707938 (patch)
treeebf5e1a1aee9ef25a506a5930df18424fd1cc862
parenta225bf05e000ec5240bff98a75839362130eace9 (diff)
Add sanity check to ensure delimiter and quote are different in CSV mode
-rw-r--r--src/backend/commands/copy.c7
1 files changed, 6 insertions, 1 deletions
diff --git a/src/backend/commands/copy.c b/src/backend/commands/copy.c
index 52e7e695273..33d360c31d2 100644
--- a/src/backend/commands/copy.c
+++ b/src/backend/commands/copy.c
@@ -8,7 +8,7 @@
*
*
* IDENTIFICATION
- * $PostgreSQL: pgsql/src/backend/commands/copy.c,v 1.293 2007/12/27 18:28:58 tgl Exp $
+ * $PostgreSQL: pgsql/src/backend/commands/copy.c,v 1.294 2007/12/30 14:46:52 adunstan Exp $
*
*-------------------------------------------------------------------------
*/
@@ -906,6 +906,11 @@ DoCopy(const CopyStmt *stmt, const char *queryString)
(errcode(ERRCODE_FEATURE_NOT_SUPPORTED),
errmsg("COPY quote must be a single ASCII character")));
+ if (cstate->csv_mode && cstate->delim[0] == cstate->quote[0])
+ ereport(ERROR,
+ (errcode(ERRCODE_INVALID_PARAMETER_VALUE),
+ errmsg("COPY delimiter and quote must be different")));
+
/* Check escape */
if (!cstate->csv_mode && cstate->escape != NULL)
ereport(ERROR,