Changeset: 1ad4a15ee789 for MonetDB URL: http://dev.monetdb.org/hg/MonetDB?cmd=changeset;node=1ad4a15ee789 Modified Files: sql/ChangeLog.Jul2012 sql/server/sql_parser.y Branch: Jul2012 Log Message:
COPY INTO: make binary explicit, allow parenthesis around file names It seems some SQL dialects need/allow parenthesis around file names in the COPY INTO statement. This triggered for us a binary copy into mode. Because such subtle difference (added parenthesis) is not a good thing (with SQL), binary mode now requires the BINARY keyword, e.g. 'COPY BINARY INTO ...'. Due to this distinction, parenthesis can now be used in normal COPY INTO without changing the meaning of the statement, and hence we optionally allow their usage to accomodate those who are used to them. diffs (54 lines): diff --git a/sql/ChangeLog.Jul2012 b/sql/ChangeLog.Jul2012 --- a/sql/ChangeLog.Jul2012 +++ b/sql/ChangeLog.Jul2012 @@ -1,3 +1,7 @@ # ChangeLog file for sql # This file is updated with Maddlog +* Fri Jun 29 2012 Fabian Groffen <fab...@cwi.nl> +- COPY INTO now accepts optional parenthesis for file argument. + Binary COPY INTO now requires 'COPY BINARY INTO'. + diff --git a/sql/server/sql_parser.y b/sql/server/sql_parser.y --- a/sql/server/sql_parser.y +++ b/sql/server/sql_parser.y @@ -346,6 +346,7 @@ int yydebug=1; opt_seps opt_nr string_commalist + string_commalist_contents paramlist opt_paramlist opt_typelist @@ -2466,14 +2467,13 @@ copyfrom_stmt: append_string(l, $8); append_int(l, $9); $$ = _symbol_create_list( SQL_COPYFROM, l ); } -/* binary copy from */ - | COPY opt_nr INTO qname FROM '(' string_commalist ')' + | COPY opt_nr BINARY INTO qname FROM string_commalist /* binary copy from */ { dlist *l = L(); if ($2 != NULL) { yyerror("COPY INTO: cannot pass number of records when using binary COPY INTO"); YYABORT; } - append_list(l, $4); + append_list(l, $5); append_list(l, $7); $$ = _symbol_create_list( SQL_BINCOPYFROM, l ); } | COPY select_no_parens_orderby INTO string opt_seps opt_null_string @@ -2538,8 +2538,13 @@ opt_locked: ; string_commalist: + string_commalist_contents { $$ = $1; } + | '(' string_commalist_contents ')' { $$ = $2; } + ; + +string_commalist_contents: string { $$ = append_string(L(), $1); } - | string_commalist ',' string + | string_commalist_contents ',' string { $$ = append_string($1, $3); } ; _______________________________________________ Checkin-list mailing list Checkin-list@monetdb.org http://mail.monetdb.org/mailman/listinfo/checkin-list