{"action":"created","issue":{"url":"https://api.github.com/repos/dimitri/pgloader/issues/298","labels_url":"https://api.github.com/repos/dimitri/pgloader/issues/298/labels{/name}","comments_url":"https://api.github.com/repos/dimitri/pgloader/issues/298/comments","events_url":"https://api.github.com/repos/dimitri/pgloader/issues/298/events","html_url":"https://github.com/dimitri/pgloader/issues/298","id":107503726,"number":298,"title":"Argument --with \"fields terminated by ... \"  in command line","user":{"login":"jacques-p","id":14349149,"avatar_url":"https://avatars.githubusercontent.com/u/14349149?v=3","gravatar_id":"","url":"https://api.github.com/users/jacques-p","html_url":"https://github.com/jacques-p","followers_url":"https://api.github.com/users/jacques-p/followers","following_url":"https://api.github.com/users/jacques-p/following{/other_user}","gists_url":"https://api.github.com/users/jacques-p/gists{/gist_id}","starred_url":"https://api.github.com/users/jacques-p/starred{/owner}{/repo}","subscriptions_url":"https://api.github.com/users/jacques-p/subscriptions","organizations_url":"https://api.github.com/users/jacques-p/orgs","repos_url":"https://api.github.com/users/jacques-p/repos","events_url":"https://api.github.com/users/jacques-p/events{/privacy}","received_events_url":"https://api.github.com/users/jacques-p/received_events","type":"User","site_admin":false},"labels":[],"state":"open","locked":false,"assignee":null,"milestone":null,"comments":3,"created_at":"2015-09-21T12:45:26Z","updated_at":"2015-12-10T11:36:27Z","closed_at":null,"body":"Hello, \r\n\r\nPreliminary remark : the loading works with a separated command file pgloader_commands.txt  but not  with command line arguments\r\n\r\n```\r\n-- pgloader_commands.txt :\r\nLOAD CSV\r\n      FROM './donnees_a_charger.csv' (a, b, c)\r\n      INTO postgresql://anonymous:anonymous@myMachine:5432/myBase?titi(a,b,c)\r\nWITH fields terminated by ','\r\n;\r\n```\r\n-- OK with :\r\npgloader pgloader_commands.txt\r\n\r\npgloader version \"3.2.0\"\r\ncompiled with SBCL 1.1.14\r\n\r\n\r\n-- The problem :\r\n-- with a table named titi created as following :\r\n```\r\npsql -h myMachine -d myBase -U anonymous -p 5432\r\nCREATE TABLE titi(a integer, b  real, c varchar);\r\n```\r\n\r\n-- a data file named donnees_a_charger.csv :\r\n```\r\n12145001,20.1,tonton est là\r\n12145001,205,titi\r\n```\r\n\r\n-- pgloader launched with command line arguments :\r\n```\r\npgloader --type csv   \\\r\n--field a  --field b  --field c           \\\r\n--with \"fields terminated by ','\"         \\\r\n--debug --verbose                         \\\r\n./donnees_a_charger.csv                   \\\r\npostgres://anonymous:anonymous@myMachine:5432/myBase?tablename=titi\r\n```\r\n\r\n-- the result :\r\n```\r\nsb-impl::*default-external-format* :UTF-8\r\ntmpdir: #P\"/tmp/pgloader/\"\r\nAn unhandled error condition has been signalled: At\r\n\r\n  fields terminated by ','\r\n  ^ (Line 1, Column 0, Position 0)\r\n\r\nCould not parse KW-NO. Expected:\r\n\r\n     the character Space\r\n  or the character Tab\r\n  or the character Newline\r\n  or the string \"--\"\r\n  or the string \"/*\"\r\n  or the string \"no\", disregarding case\r\n\r\nReached via\r\n\r\n     KW-NO\r\n  -> (AND IGNORE-WHITESPACE (~ \"no\") IGNORE-WHITESPACE)\r\n2015-09-21T12:32:38.033000Z NOTICE Starting pgloader, log system is ready.\r\n2015-09-21T12:32:38.057000Z INFO Starting monitor\r\n2015-09-21T12:32:38.063000Z LOG Main logs in '/tmp/pgloader/pgloader.log'\r\n2015-09-21T12:32:38.063000Z LOG Data errors in '/tmp/pgloader/'\r\n  -> \"no\"\r\n\r\n2015-09-21T12:32:38.064000Z INFO SOURCE: #<PGLOADER.CSV:CSV-CONNECTION copy://FILENAME:./donnees_a_charger.csv {1006FAC803}>\r\n2015-09-21T12:32:38.064000Z INFO TARGET: #<PGLOADER.PGSQL:PGSQL-CONNECTION pgsql://anonymous@myMachine:5432/myBase {10070CC463}>\r\n2015-09-21T12:32:38.064000Z FATAL We have a situation here.\r\nCould not parse WHITESPACE. Expected:\r\n\r\n     the character Space\r\n  or the character Tab\r\n  or the character Newline\r\n  or the string \"--\"\r\n  or the string \"/*\"\r\n\r\nReached via\r\n\r\n     WHITESPACE\r\n  -> (+ (OR Space Tab Newline Newline COMMENTS))\r\n  -> (OR Space Tab Newline Newline COMMENTS)\r\n  -> COMMENTS\r\n  -> (OR SINGLE-LINE-COMMENT MULTI-LINE-COMMENT)\r\n  -> MULTI-LINE-COMMENT\r\n  -> (AND \"/*\" (+ (NOT \"*/\")) \"*/\")\r\n  -> \"/*\"\r\n\r\nCould not parse COPY-OPTION. Expected:\r\n\r\n     the string \"truncate\", disregarding case\r\n  or the string \"skip\", disregarding case\r\n  or the character Space\r\n  or the character Tab\r\n  or the character Newline\r\n  or the string \"--\"\r\n  or the string \"/*\"\r\n  or the string \"batch\", disregarding case\r\n\r\nReached via\r\n\r\n     COPY-OPTION\r\n  -> (OR OPTION-BATCH-ROWS OPTION-BATCH-SIZE OPTION-BATCH-CONCURRENCY\r\n         OPTION-TRUNCATE OPTION-SKIP-HEADER)\r\n  -> OPTION-SKIP-HEADER\r\n  -> (AND KW-SKIP KW-HEADER EQUAL-SIGN (+ (DIGIT-CHAR-P CHARACTER)))\r\n  -> KW-SKIP\r\n  -> (AND IGNORE-WHITESPACE (~ \"skip\") IGNORE-WHITESPACE)\r\n  -> \"skip\"\r\n\r\nDate/time: 2015-09-21-12:32An unhandled error condition has been signalled: At\r\n\r\n  fields terminated by ','\r\n  ^ (Line 1, Column 0, Position 0)\r\n\r\nCould not parse KW-NO. Expected:\r\n\r\n     the character Space\r\n  or the character Tab\r\n  or the character Newline\r\n  or the string \"--\"\r\n  or the string \"/*\"\r\n  or the string \"no\", disregarding case\r\n\r\nReached via\r\n\r\n     KW-NO\r\n  -> (AND IGNORE-WHITESPACE (~ \"no\") IGNORE-WHITESPACE)\r\n  -> \"no\"\r\n\r\nCould not parse WHITESPACE. Expected:\r\n\r\n     the character Space\r\n  or the character Tab\r\n  or the character Newline\r\n  or the string \"--\"\r\n  or the string \"/*\"\r\n\r\nReached via\r\n\r\n     WHITESPACE\r\n  -> (+ (OR Space Tab Newline Newline COMMENTS))\r\n  -> (OR Space Tab Newline Newline COMMENTS)\r\n  -> COMMENTS\r\n  -> (OR SINGLE-LINE-COMMENT MULTI-LINE-COMMENT)\r\n  -> MULTI-LINE-COMMENT\r\n  -> (AND \"/*\" (+ (NOT \"*/\")) \"*/\")\r\n  -> \"/*\"\r\n\r\nCould not parse COPY-OPTION. Expected:\r\n\r\n     the string \"truncate\", disregarding case\r\n  or the string \"skip\", disregarding case\r\n  or the character Space\r\n  or the character Tab\r\n  or the character Newline\r\n  or the string \"--\"\r\n  or the string \"/*\"\r\n  or the string \"batch\", disregarding case\r\n\r\nReached via\r\n\r\n     COPY-OPTION\r\n  -> (OR OPTION-BATCH-ROWS OPTION-BATCH-SIZE OPTION-BATCH-CONCURRENCY\r\n         OPTION-TRUNCATE OPTION-SKIP-HEADER)\r\n  -> OPTION-SKIP-HEADER\r\n  -> (AND KW-SKIP KW-HEADER EQUAL-SIGN (+ (DIGIT-CHAR-P CHARACTER)))\r\n  -> KW-SKIP\r\n  -> (AND IGNORE-WHITESPACE (~ \"skip\") IGNORE-WHITESPACE)\r\n  -> \"skip\"\r\n\r\n\r\nBacktrace for: #<SB-THREAD:THREAD \"main thread\" RUNNING {1006DB39B3}>\r\n0: ((LAMBDA NIL :IN SB-DEBUG::FUNCALL-WITH-DEBUG-IO-SYNTAX))\r\n1: (SB-IMPL::CALL-WITH-SANE-IO-SYNTAX #<CLOSURE (LAMBDA NIL :IN SB-DEBUG::FUNCALL-WITH-DEBUG-IO-SYNTAX) {10080CCA0B}>)\r\n2: (SB-IMPL::%WITH-STANDARD-IO-SYNTAX #<CLOSURE (LAMBDA NIL :IN SB-DEBUG::FUNCALL-WITH-DEBUG-IO-SYNTAX) {10080CC9DB}>)\r\n3: (PRINT-BACKTRACE :STREAM #<SYNONYM-STREAM :SYMBOL SB-SYS:*STDOUT* {10002CBC13}> :START 0 :FROM :DEBUGGER-FRAME :COUNT 4611686018427387903 :PRINT-THREAD T :PRINT-FRAME-SOURCE NIL :METHOD-FRAME-STYLE NIL)\r\n4: (TRIVIAL-BACKTRACE:PRINT-BACKTRACE-TO-STREAM #<SYNONYM-STREAM :SYMBOL SB-SYS:*STDOUT* {10002CBC13}>)\r\n5: (TRIVIAL-BACKTRACE:PRINT-BACKTRACE #<ESRAP:ESRAP-PARSE-ERROR @0 (3) {10070DA9D3}> :OUTPUT #<SYNONYM-STREAM :SYMBOL SB-SYS:*STDOUT* {10002CBC13}> :IF-EXISTS :APPEND :VERBOSE T)\r\n6: (SIGNAL #<ESRAP:ESRAP-PARSE-ERROR @0 (3) {10070DA9D3}>)\r\n7: (ERROR ESRAP:ESRAP-PARSE-ERROR :TEXT \"fields terminated by ','\" :POSITION 0 :ATTEMPTS (#<ESRAP::PARSE-ATTEMPT @0 (3) {10070D9273}> #<ESRAP::PARSE-ATTEMPT @0 (8) {10070D9D13}> #<ESRAP::PARSE-ATTEMPT @0 (7) {10070DA883}>))\r\n8: (ESRAP:ESRAP-PARSE-ERROR \"fields terminated by ','\" 0 (#<ESRAP::PARSE-ATTEMPT @0 (3) {10070D9273}> #<ESRAP::PARSE-ATTEMPT @0 (8) {10070D9D13}> #<ESRAP::PARSE-ATTEMPT @0 (7) {10070DA883}>))\r\n9: (ESRAP::EXPLAIN-FAILED-PARSE #S(ESRAP::FAILED-PARSE :EXPRESSION PGLOADER.PARSER::COPY-OPTION :START 0 :POSITION 0 :DETAIL #S(ESRAP::FAILED-PARSE :EXPRESSION (OR PGLOADER.PARSER::OPTION-BATCH-ROWS PGLOADER.PARSER::OPTION-BATCH-SIZE PGLOADER.PARSER::OPTION-BATCH-CONCURRENCY PGLOADER.PARSER::OPTION-TRUNCATE PGLOADER.PARSER::OPTION-SKIP-HEADER) :START 0 :POSITION 0 :DETAIL (#S(ESRAP::FAILED-PARSE :EXPRESSION PGLOADER.PARSER::OPTION-SKIP-HEADER :START 0 :POSITION 0 :DETAIL #S(ESRAP::FAILED-PARSE :EXPRESSION (AND PGLOADER.PARSER::KW-SKIP PGLOADER.PARSER::KW-HEADER PGLOADER.PARSER::EQUAL-SIGN (+ (DIGIT-CHAR-P CHARACTER))) :START 0 :POSITION 0 :DETAIL #S(ESRAP::FAILED-PARSE :EXPRESSION PGLOADER.PARSER::KW-SKIP :START 0 :POSITION 0 :DETAIL #S(ESRAP::FAILED-PARSE :EXPRESSION (AND PGLOADER.PARSER::IGNORE-WHITESPACE (ESRAP:~ #1=\"skip\") PGLOADER.PARSER::IGNORE-WHITESPACE) :START 0 :POSITION 0 :DETAIL #S(ESRAP::FAILED-PARSE :EXPRESSION #1# :START 0 :POSITION 0 :DETAIL NIL))))) #S(ESRAP::FAILED-PARSE :EXPRESSION PGLOADER.PARSER::OPTION-TRUNCATE :START 0 :POSITION 0 :DETAIL #S(ESRAP::FAILED-PARSE :EXPRESSION (AND (ESRAP:? PGLOADER.PARSER::KW-NO) PGLOADER.PARSER::KW-TRUNCATE) :START 0 :POSITION 0 :DETAIL #S(ESRAP::FAILED-PARSE :EXPRESSION PGLOADER.PARSER::KW-TRUNCATE :START 0 :POSITION 0 :DETAIL #S(ESRAP::FAILED-PARSE :EXPRESSION (AND PGLOADER.PARSER::IGNORE-WHITESPACE (ESRAP:~ #2=\"truncate\") PGLOADER.PARSER::IGNORE-WHITESPACE) :START 0 :POSITION 0 :DETAIL #S(ESRAP::FAILED-PARSE :EXPRESSION #2# :START 0 :POSITION 0 :DETAIL NIL))))) #S(ESRAP::FAILED-PARSE :EXPRESSION PGLOADER.PARSER::OPTION-BATCH-CONCURRENCY :START 0 :POSITION 0 :DETAIL #S(ESRAP::FAILED-PARSE :EXPRESSION (AND PGLOADER.PARSER::KW-BATCH PGLOADER.PARSER::KW-CONCURRENCY PGLOADER.PARSER::EQUAL-SIGN #3=(+ (DIGIT-CHAR-P CHARACTER))) :START 0 :POSITION 0 :DETAIL #4=#S(ESRAP::FAILED-PARSE :EXPRESSION PGLOADER.PARSER::KW-BATCH :START 0 :POSITION 0 :DETAIL #S(ESRAP::FAILED-PARSE :EXPRESSION (AND PGLOADER.PARSER::IGNORE-WHITESPACE (ESRAP:~ #5=\"batch\") PGLOADER.PARSER::IGNORE-WHITESPACE) :START 0 :POSITION 0 :DETAIL #S(ESRAP::FAILED-PARSE :EXPRESSION #5# :START 0 :POSITION 0 :DETAIL NIL))))) #S(ESRAP::FAILED-PARSE :EXPRESSION PGLOADER.PARSER::OPTION-BATCH-SIZE :START 0 :POSITION 0 :DETAIL #S(ESRAP::FAILED-PARSE :EXPRESSION (AND PGLOADER.PARSER::KW-BATCH PGLOADER.PARSER::KW-SIZE PGLOADER.PARSER::EQUAL-SIGN PGLOADER.PARSER::BATCH-SIZE) :START 0 :POSITION 0 :DETAIL #4#)) #S(ESRAP::FAILED-PARSE :EXPRESSION PGLOADER.PARSER::OPTION-BATCH-ROWS :START 0 :POSITION 0 :DETAIL #S(ESRAP::FAILED-PARSE :EXPRESSION (AND PGLOADER.PARSER::KW-BATCH PGLOADER.PARSER::KW-ROWS PGLOADER.PARSER::EQUAL-SIGN #3#) :START 0 :POSITION 0 :DETAIL #4#))))) \"fields terminated by ','\" NIL)\r\n10: (ESRAP:PARSE PGLOADER.PARSER::COPY-OPTION \"fields terminated by ','\" :START 0 :END NIL :JUNK-ALLOWED NIL)\r\n11: (PGLOADER.PARSER:PARSE-CLI-OPTIONS :COPY (\"fields terminated by ','\"))\r\n12: ((FLET #:CLEANUP-FUN-281 :IN PGLOADER::MAIN)) [cleanup]\r\n13: (PGLOADER::MAIN (\"pgloader\" \"--type\" \"csv\" \"--field\" \"a\" \"--field\" \"b\" \"--field\" \"c\" \"--with\" \"fields terminated by ','\" \"--debug\" \"--verbose\" \"./donnees_a_charger.csv\" \"postgres://anonymous:anonymous@myMachine:5432/myBase?tablename=titi\"))\r\n14: ((LAMBDA NIL :IN \"/home/vagrant/rpmbuild/BUILD/pgloader/dumper-2SKVI5f7.lisp\"))\r\n15: ((FLET #:WITHOUT-INTERRUPTS-BODY-54 :IN SAVE-LISP-AND-DIE))\r\n16: ((LABELS SB-IMPL::RESTART-LISP :IN SAVE-LISP-AND-DIE))\r\n\r\n...\r\n```"},"comment":{"url":"https://api.github.com/repos/dimitri/pgloader/issues/comments/163585606","html_url":"https://github.com/dimitri/pgloader/issues/298#issuecomment-163585606","issue_url":"https://api.github.com/repos/dimitri/pgloader/issues/298","id":163585606,"user":{"login":"ohadle","id":2196196,"avatar_url":"https://avatars.githubusercontent.com/u/2196196?v=3","gravatar_id":"","url":"https://api.github.com/users/ohadle","html_url":"https://github.com/ohadle","followers_url":"https://api.github.com/users/ohadle/followers","following_url":"https://api.github.com/users/ohadle/following{/other_user}","gists_url":"https://api.github.com/users/ohadle/gists{/gist_id}","starred_url":"https://api.github.com/users/ohadle/starred{/owner}{/repo}","subscriptions_url":"https://api.github.com/users/ohadle/subscriptions","organizations_url":"https://api.github.com/users/ohadle/orgs","repos_url":"https://api.github.com/users/ohadle/repos","events_url":"https://api.github.com/users/ohadle/events{/privacy}","received_events_url":"https://api.github.com/users/ohadle/received_events","type":"User","site_admin":false},"created_at":"2015-12-10T11:36:27Z","updated_at":"2015-12-10T11:36:27Z","body":"@dimitri thanks for the quick response! And all your work of course :)\r\n\r\nIf the field names were missing, the config file option shouldn't have worked, but it did. I assumed the field names were found when I stated `fields terminated by ','`. The only difference as far as I can tell was running the commands with a config file and running the same commands as CLI args.\r\n\r\nA different issue is that I couldn't get `csv header` to compile at all, whether via config or CLI. Here's the config file I used (should I open a separate issue?):\r\n```\r\n➜  csv  cat pgloader_defs.pgload              \r\nLOAD CSV\r\n\tFROM '/media/sf_Data/csv/1048.csv'\r\n\tINTO  postgresql://myuser:mypass@1.2.3.4:5432/db?tablename=s.t\r\n\tWITH fields terminated by ',',\r\n\t\t skip header = 1,\r\n\t\t csv header\r\n;\r\n➜  csv  pgloader -v pgloader_defs.pgload\r\nAn unhandled error condition has been signalled: At\r\n\r\n  LOAD CSV\r\n  ^ (Line 1, Column 0, Position 0)\r\n\r\nCould not parse subexpression \";\" when parsing\r\n\r\n Expression PGLOADER.PARSER::COMMANDS\r\n    Subexpression (+ PGLOADER.PARSER::COMMAND)\r\n    Subexpression PGLOADER.PARSER::COMMAND\r\n    Subexpression (AND\r\n                   (OR PGLOADER.PARSER::LOAD-ARCHIVE\r\n                       PGLOADER.PARSER::LOAD-CSV-FILE\r\n                       PGLOADER.PARSER::LOAD-FIXED-COLS-FILE\r\n                       PGLOADER.PARSER::LOAD-COPY-FILE\r\n                       PGLOADER.PARSER::LOAD-DBF-FILE\r\n                       PGLOADER.PARSER::LOAD-IXF-FILE\r\n                       PGLOADER.PARSER::LOAD-MYSQL-DATABASE\r\n                       PGLOADER.PARSER::LOAD-MSSQL-DATABASE\r\n                       PGLOADER.PARSER::LOAD-SQLITE-DATABASE)\r\n                   PGLOADER.PARSER::END-OF-COMMAND)\r\n    Subexpression PGLOADER.PARSER::END-OF-COMMAND\r\n    Subexpression (AND PGLOADER.PARSER::IGNORE-WHITESPACE #\\;\r\n                       PGLOADER.PARSER::IGNORE-WHITESPACE)\r\n    Subexpression \";\"\r\n\r\n; \r\n; compilation unit aborted\r\n;   caught 1 fatal ERROR condition\r\n```"}}