aboutsummaryrefslogtreecommitdiff
path: root/src/bin/psql/copy.c
diff options
context:
space:
mode:
Diffstat (limited to 'src/bin/psql/copy.c')
-rw-r--r--src/bin/psql/copy.c14
1 files changed, 11 insertions, 3 deletions
diff --git a/src/bin/psql/copy.c b/src/bin/psql/copy.c
index 7b38d26a639..86893da5abd 100644
--- a/src/bin/psql/copy.c
+++ b/src/bin/psql/copy.c
@@ -3,7 +3,7 @@
*
* Copyright 2000 by PostgreSQL Global Development Group
*
- * $Header: /cvsroot/pgsql/src/bin/psql/copy.c,v 1.14 2000/04/14 23:43:44 petere Exp $
+ * $Header: /cvsroot/pgsql/src/bin/psql/copy.c,v 1.15 2000/04/16 15:46:40 petere Exp $
*/
#include "postgres.h"
#include "copy.h"
@@ -34,7 +34,7 @@ bool copy_in_state;
* parse_slash_copy
* -- parses \copy command line
*
- * Accepted syntax: \copy [binary] table|"table" [with oids] from|to filename|'filename' using delimiters ['<char>'] [ with null as 'string' ]
+ * Accepted syntax: \copy [binary] table|"table" [with oids] from|to filename|'filename' [ using delimiters '<char>'] [ with null as 'string' ]
* (binary is not here yet)
*
* returns a malloc'ed structure with the options, or NULL on parsing error
@@ -74,7 +74,13 @@ parse_slash_copy(const char *args)
bool error = false;
char quote;
- line = xstrdup(args);
+ if (args)
+ line = xstrdup(args);
+ else
+ {
+ psql_error("\\copy: arguments required\n");
+ return NULL;
+ }
if (!(result = calloc(1, sizeof(struct copy_options))))
{
@@ -191,6 +197,8 @@ parse_slash_copy(const char *args)
}
}
}
+ else
+ error = true;
}
}
}