Changeset: d58e5e1c88e9 for MonetDB
URL: https://dev.monetdb.org/hg/MonetDB?cmd=changeset;node=d58e5e1c88e9
Added Files:
        sql/test/BugTracker-2019/Tests/copy-into-unicode-quote.Bug-6716.sql
        
sql/test/BugTracker-2019/Tests/copy-into-unicode-quote.Bug-6716.stable.err
        
sql/test/BugTracker-2019/Tests/copy-into-unicode-quote.Bug-6716.stable.out
        sql/test/BugTracker-2019/Tests/insert-into-select.Bug-6718.sql
        sql/test/BugTracker-2019/Tests/insert-into-select.Bug-6718.stable.err
        sql/test/BugTracker-2019/Tests/insert-into-select.Bug-6718.stable.out
Modified Files:
        clients/mapiclient/mhelp.c
        monetdb5/mal/mal_import.c
        sql/backends/monet5/sql.c
        sql/test/BugTracker-2019/Tests/All
        sql/test/sys-schema/Tests/check_ForeignKey_referential_integrity.sql
        
sql/test/sys-schema/Tests/check_ForeignKey_referential_integrity.stable.out
        sql/test/sys-schema/Tests/check_Not_Nullable_columns.sql
        sql/test/sys-schema/Tests/check_Not_Nullable_columns.stable.out
Branch: context
Log Message:

merged with default


diffs (truncated from 722 to 300 lines):

diff --git a/clients/mapiclient/mhelp.c b/clients/mapiclient/mhelp.c
--- a/clients/mapiclient/mhelp.c
+++ b/clients/mapiclient/mhelp.c
@@ -60,10 +60,10 @@ SQLhelp sqlhelp1[] = {
         "See also https://www.monetdb.org/Documentation/SQLreference/Alter"},
        {"ALTER MERGE TABLE",
         "",
-        "ALTER TABLE [ IF EXISTS ] qname ADD TABLE qname [ AS PARTITION 
opt_partition_spec ]\n"
+        "ALTER TABLE [ IF EXISTS ] qname ADD TABLE qname [ AS PARTITION 
partition_spec ]\n"
         "ALTER TABLE [ IF EXISTS ] qname DROP TABLE qname [ RESTRICT | CASCADE 
]\n"
-        "ALTER TABLE [ IF EXISTS ] qname SET TABLE qname AS PARTITION 
opt_partition_spec",
-        "qname,opt_partition_spec",
+        "ALTER TABLE [ IF EXISTS ] qname SET TABLE qname AS PARTITION 
partition_spec",
+        "qname,partition_spec",
         "See also 
https://www.monetdb.org/Documentation/Cookbooks/SQLrecipes/DataPartitioning"},
        {"ALTER SCHEMA",
         "",
@@ -183,8 +183,8 @@ SQLhelp sqlhelp1[] = {
         "See also 
https://www.monetdb.org/blog/monetdbpython-loader-functions"},
        {"CREATE MERGE TABLE",
         "",
-        "CREATE MERGE TABLE [ IF NOT EXISTS ] qname table_source [ 
opt_partition_by ];",
-        "table_source,opt_partition_by",
+        "CREATE MERGE TABLE [ IF NOT EXISTS ] qname table_source [ 
partition_by ]",
+        "table_source,partition_by",
         "See also 
https://www.monetdb.org/Documentation/Cookbooks/SQLrecipes/DataPartitioning"},
        {"CREATE REMOTE TABLE",
         "",
@@ -193,7 +193,7 @@ SQLhelp sqlhelp1[] = {
         "remote name should match 
mapi:monetdb://host:port/database[/schema[/table]]"},
        {"CREATE REPLICA TABLE",
         "",
-        "CREATE REPLICA TABLE [ IF NOT EXISTS ] qname table_source;",
+        "CREATE REPLICA TABLE [ IF NOT EXISTS ] qname table_source",
         NULL,
         "See also 
https://www.monetdb.org/Documentation/Cookbooks/SQLrecipes/TransactionReplication"},
        {"CREATE ROLE",
@@ -304,8 +304,8 @@ SQLhelp sqlhelp1[] = {
         NULL},
        {"DELETE",
         "",
-        "[ WITH with_list ] DELETE FROM qname [ [AS] ident ] [ WHERE 
search_condition ]",
-        "with_list,search_condition",
+        "[ WITH cte_list ] DELETE FROM qname [ [AS] ident ] [ WHERE 
search_condition ]",
+        "cte_list,search_condition",
         NULL},
        {"DROP AGGREGATE",
         "",
@@ -385,8 +385,8 @@ SQLhelp sqlhelp1[] = {
         "See also 
https://www.monetdb.org/Documentation/SQLreference/Flowofcontrol"},
        {"INSERT",
         "",
-        "[ WITH with_list ] INSERT INTO qname [ column_list ] [ { DEFAULT 
VALUES | VALUES row_values | query_expression } ]",
-        "with_list,column_list,row_values,query_expression",
+        "[ WITH cte_list ] INSERT INTO qname [ column_list ] [ { DEFAULT 
VALUES | VALUES row_values | query_expression } ]",
+        "cte_list,column_list,row_values,query_expression",
         "See also https://www.monetdb.org/Documentation/SQLreference/Updates"},
        {"GRANT",
         "Define access privileges",
@@ -396,9 +396,9 @@ SQLhelp sqlhelp1[] = {
         "See also 
https://www.monetdb.org/Documentation/SQLreference/Permissions"},
        {"MERGE",
         "",
-        "[ WITH with_list ] MERGE INTO qname [ [AS] ident ] USING table_ref [ 
[AS] ident ] ON search_condition merge_list",
-        "with_list,table_ref,search_condition,merge_list",
-        NULL},
+        "[ WITH cte_list ] MERGE INTO qname [ [AS] ident ] USING table_ref [ 
[AS] ident ] ON search_condition merge_list",
+        "cte_list,table_ref,search_condition,merge_list",
+        "See also: 
https://www.monetdb.org/blog/sql2003_merge_statements_now_supported"},
        {"RELEASE SAVEPOINT",
         "",
         "RELEASE SAVEPOINT ident",
@@ -427,7 +427,7 @@ SQLhelp sqlhelp1[] = {
         NULL},
        {"SELECT",
         "",
-        "[ WITH with_list ]\n"
+        "[ WITH cte_list ]\n"
         "SELECT [ ALL | DISTINCT [ ON { expression [',' ...] } ] ]\n"
         "[ '*' | expression [ [ AS ] output_name ] [',' ...] ]\n"
         "[ FROM from_item [',' ...] ]\n"
@@ -440,7 +440,7 @@ SQLhelp sqlhelp1[] = {
         "[ LIMIT { count | param } ]\n"
         "[ OFFSET { count | param } ]\n"
         "[ SAMPLE size [ SEED size ] ]",
-        "with_list,expression,window_definition",
+        "cte_list,expression,window_definition",
         "See also 
https://www.monetdb.org/Documentation/SQLreference/TableExpressions"},
        {"SET",
         "Assign a value to a variable or column",
@@ -513,8 +513,8 @@ SQLhelp sqlhelp1[] = {
         NULL},
        {"UPDATE",
         "",
-        "[ WITH with_list ] UPDATE qname [ [AS] ident ] SET assignment_list [ 
WHERE search_condition ]",
-        "with_list,assignment_list,search_condition",
+        "[ WITH cte_list ] UPDATE qname [ [AS] ident ] SET assignment_list [ 
WHERE search_condition ]",
+        "cte_list,assignment_list,search_condition",
         NULL},
        {"VALUES",
         "",
@@ -675,16 +675,16 @@ SQLhelp sqlhelp2[] = {
         "MATCH { FULL | PARTIAL | SIMPLE }",
         NULL,
         NULL},
+       {"merge_list",
+        NULL,
+        "merge_clause [ merge_clause ]",
+        "merge_clause",
+        NULL},
        {"merge_clause",
         NULL,
-        "{ WHEN MATCHED [ AND search_condition ] THEN { UPDATE SET 
assignment_list | DELETE } } |\n"
-        "{ WHEN NOT MATCHED [ AND search_condition ] THEN INSERT [ column_list 
] [ { DEFAULT VALUES | VALUES row_values } ] }",
-        "search_condition,assignment_list,column_list,row_values",
-        NULL},
-       {"merge_list",
-        NULL,
-        "merge_clause [ ... ]",
-        "merge_clause",
+        "{ WHEN NOT MATCHED THEN INSERT [ column_list ] [ { VALUES row_values 
| DEFAULT VALUES } ]\n"
+        "| WHEN MATCHED THEN { UPDATE SET assignment_list | DELETE } }",
+        "column_list,row_values,assignment_list",
         NULL},
        {"nrofrecords",
         "",
@@ -696,18 +696,18 @@ SQLhelp sqlhelp2[] = {
         "ON COMMIT { DELETE ROWS | PRESERVE ROWS | DROP }",
         NULL,
         NULL},
-       {"opt_partition_by",
+       {"partition_by",
         NULL,
         "PARTITION BY { RANGE | VALUES } { ON '(' ident ')' | USING '(' 
query_expression ')' }",
         "query_expression",
-        NULL},
-       {"opt_partition_spec",
+        "See also: https://www.monetdb.org/blog/updatable-merge-tables"},
+       {"partition_spec",
         NULL,
-        "IN '(' partition_list ')' [ WITH NULL VALUES ]\n"
-        "FROM partition_range_from TO partition_range_to [ WITH NULL VALUES 
]\n"
-        "FOR NULL VALUES",
+        "{ IN '(' partition_list ')' [ WITH NULL VALUES ]\n"
+        "| FROM partition_range_from TO partition_range_to [ WITH NULL VALUES 
]\n"
+        "| FOR NULL VALUES }",
         "partition_list,partition_range_from,partition_range_to",
-        NULL},
+        "See also: https://www.monetdb.org/blog/updatable-merge-tables"},
        {"param",
         NULL,
         "ident data_type",
@@ -739,10 +739,27 @@ SQLhelp sqlhelp2[] = {
         "  declare | set_statement | control_statement | select_single_row } 
';'",
         
"transaction_statement,update_statement,grant,revoke,declare,set_statement,control_statement,select_single_row",
         NULL},
+       {"select_single_row",
+        NULL,
+        "SELECT [ ALL | DISTINCT ] column_exp_commalist INTO 
select_target_list [ from_clause ] [ window_clause ] [ where_clause ] [ 
group_by_clause ] [ having_clause ]",
+        
"column_exp_commalist,select_target_list,from_clause,window_clause,where_clause,group_by_clause,having_clause",
+        NULL},
        {"query_expression",
         NULL,
-        "with_query | select_no_parens_orderby",
+        "select_no_parens [ order_by_clause ] [ limit_clause ] [ offset_clause 
] [ sample_clause ]",
+        
"select_no_parens,order_by_clause,limit_clause,offset_clause,sample_clause",
+        NULL},
+       {"select_no_parens",
         NULL,
+        "{ SELECT [ ALL | DISTINCT ] column_exp_commalist [ from_clause ] [ 
window_clause ] [ where_clause ] [ group_by_clause ] [ having_clause ]\n"
+        "| select_no_parens { UNION | EXCEPT | INTERSECT } [ ALL | DISTINCT ] 
[ corresponding ] select_no_parens\n"
+        "| '(' select_no_parens ')' }",
+        
"column_exp_commalist,from_clause,window_clause,where_clause,group_by_clause,having_clause,corresponding",
+        NULL},
+       {"corresponding",
+        NULL,
+        "{ CORRESPONDING | CORRESPONDING BY '(' column_ref_commalist ')' }",
+        "column_ref_commalist",
         NULL},
        {"qname",
         NULL,
@@ -897,9 +914,9 @@ SQLhelp sqlhelp2[] = {
         "  [ EXCLUDING { CURRENT ROW | GROUP | TIES | NO OTHERS } ] ]",
         "window_bound,window_frame_start",
         NULL},
-       {"with_list",
+       {"cte_list",
         NULL,
-        "ident [ column_list ] AS query_expression [ ',' with_list ] ...",
+        "ident [ column_list ] AS query_expression [ ',' cte_list ] ...",
         "column_list,query_expression",
         NULL},
        {NULL, NULL, NULL, NULL, NULL}  /* End of list marker */
diff --git a/monetdb5/mal/mal_import.c b/monetdb5/mal/mal_import.c
--- a/monetdb5/mal/mal_import.c
+++ b/monetdb5/mal/mal_import.c
@@ -267,7 +267,7 @@ evalFile(str fname, int listing)
                if (fd)
                        close_stream(fd);
                throw(MAL,"mal.eval", "WARNING: could not open file '%s'\n", 
fname);
-       } 
+       }
 
        c= MCinitClient((oid)0, bstream_create(fd, 128 * BLOCK),0);
        if( c == NULL){
diff --git a/sql/backends/monet5/sql.c b/sql/backends/monet5/sql.c
--- a/sql/backends/monet5/sql.c
+++ b/sql/backends/monet5/sql.c
@@ -2663,7 +2663,10 @@ mvc_import_table_wrap(Client cntxt, MalB
        }
 
        be = cntxt->sqlcontext;
-       if (*ssep == 0)
+       /* The CSV parser expects ssep to have the value 0 if the user does not
+        * specify a quotation character
+        */
+       if (*ssep == 0 || strcmp(ssep, str_nil) == 0)
                ssep = NULL;
 
        if (fname != NULL && strcmp(str_nil, fname) == 0)
diff --git a/sql/test/BugTracker-2019/Tests/All 
b/sql/test/BugTracker-2019/Tests/All
--- a/sql/test/BugTracker-2019/Tests/All
+++ b/sql/test/BugTracker-2019/Tests/All
@@ -15,3 +15,5 @@ prepared-merge-statement.Bug-6706
 view-where-cast-error.Bug-6712
 correlated-subquery-aggregation.Bug-6714
 merge-statement-aliases.Bug-6715
+insert-into-select.Bug-6718
+copy-into-unicode-quote.Bug-6716
diff --git 
a/sql/test/BugTracker-2019/Tests/copy-into-unicode-quote.Bug-6716.sql 
b/sql/test/BugTracker-2019/Tests/copy-into-unicode-quote.Bug-6716.sql
new file mode 100644
--- /dev/null
+++ b/sql/test/BugTracker-2019/Tests/copy-into-unicode-quote.Bug-6716.sql
@@ -0,0 +1,16 @@
+start transaction;
+
+create table foo (i bigint, t text, f int);
+copy into foo from stdin;
+1689|00i\047m|2
+1690|00i\047v|2
+41561|2015‎|1
+45804|21π|1
+51981|24hours‬|1
+171067|ardèch|2
+182773|afi|1
+607808|poverty‪|1
+
+-- empty line to signal end of input
+select * from foo;
+rollback;
diff --git 
a/sql/test/BugTracker-2019/Tests/copy-into-unicode-quote.Bug-6716.stable.err 
b/sql/test/BugTracker-2019/Tests/copy-into-unicode-quote.Bug-6716.stable.err
new file mode 100644
--- /dev/null
+++ b/sql/test/BugTracker-2019/Tests/copy-into-unicode-quote.Bug-6716.stable.err
@@ -0,0 +1,33 @@
+stderr of test 'copy-into-unicode-quote.Bug-6716` in directory 
'sql/test/BugTracker-2019` itself:
+
+
+# 14:16:53 >  
+# 14:16:53 >  "mserver5" "--debug=10" "--set" "gdk_nr_threads=0" "--set" 
"mapi_open=true" "--set" "mapi_port=31951" "--set" 
"mapi_usock=/var/tmp/mtest-12124/.s.monetdb.31951" "--set" "monet_prompt=" 
"--forcemito" 
"--dbpath=/home/kutsurak/work/monet/sources/MonetDB/build/install/var/MonetDB/mTests_sql_test_BugTracker-2019"
 "--set" "embedded_c=true"
+# 14:16:53 >  
+
+# builtin opt  gdk_dbpath = 
/home/kutsurak/work/monet/sources/MonetDB/build/install/var/monetdb5/dbfarm/demo
+# builtin opt  monet_prompt = >
+# builtin opt  monet_daemon = no
+# builtin opt  mapi_port = 50000
+# builtin opt  mapi_open = false
+# builtin opt  mapi_autosense = false
+# builtin opt  sql_optimizer = default_pipe
+# builtin opt  sql_debug = 0
+# cmdline opt  gdk_nr_threads = 0
+# cmdline opt  mapi_open = true
+# cmdline opt  mapi_port = 31951
+# cmdline opt  mapi_usock = /var/tmp/mtest-12124/.s.monetdb.31951
+# cmdline opt  monet_prompt = 
+# cmdline opt  gdk_dbpath = 
/home/kutsurak/work/monet/sources/MonetDB/build/install/var/MonetDB/mTests_sql_test_BugTracker-2019
+# cmdline opt  embedded_c = true
+#main thread:!ERROR:MALException:client.quit:Server stopped
+
+# 14:16:54 >  
+# 14:16:54 >  "mclient" "-lsql" "-ftest" "-tnone" "-Eutf-8" "-i" "-e" 
"--host=/var/tmp/mtest-12124" "--port=31951"
+# 14:16:54 >  
+
+
+# 14:16:54 >  
+# 14:16:54 >  "Done."
+# 14:16:54 >  
+
diff --git 
a/sql/test/BugTracker-2019/Tests/copy-into-unicode-quote.Bug-6716.stable.out 
b/sql/test/BugTracker-2019/Tests/copy-into-unicode-quote.Bug-6716.stable.out
new file mode 100644
--- /dev/null
+++ b/sql/test/BugTracker-2019/Tests/copy-into-unicode-quote.Bug-6716.stable.out
@@ -0,0 +1,56 @@
+stdout of test 'copy-into-unicode-quote.Bug-6716` in directory 
'sql/test/BugTracker-2019` itself:
+
+
+# 14:16:53 >  
+# 14:16:53 >  "mserver5" "--debug=10" "--set" "gdk_nr_threads=0" "--set" 
"mapi_open=true" "--set" "mapi_port=31951" "--set" 
"mapi_usock=/var/tmp/mtest-12124/.s.monetdb.31951" "--set" "monet_prompt=" 
"--forcemito" 
"--dbpath=/home/kutsurak/work/monet/sources/MonetDB/build/install/var/MonetDB/mTests_sql_test_BugTracker-2019"
 "--set" "embedded_c=true"
+# 14:16:53 >  
+
_______________________________________________
checkin-list mailing list
checkin-list@monetdb.org
https://www.monetdb.org/mailman/listinfo/checkin-list

Reply via email to