Changeset: 5ba5c6fde1dc for MonetDB
URL: https://dev.monetdb.org/hg/MonetDB?cmd=changeset;node=5ba5c6fde1dc
Modified Files:
        sql/backends/monet5/sql_result.c
        sql/test/BugTracker-2020/Tests/copy-decimal-with-space.Bug-6917.sql
        
sql/test/BugTracker-2020/Tests/copy-decimal-with-space.Bug-6917.stable.err
Branch: Jun2020
Log Message:

Don't accept more digits than the type allows.


diffs (46 lines):

diff --git a/sql/backends/monet5/sql_result.c b/sql/backends/monet5/sql_result.c
--- a/sql/backends/monet5/sql_result.c
+++ b/sql/backends/monet5/sql_result.c
@@ -613,8 +613,6 @@ bat_max_hgelength(BAT *b)
                                res += *s++ - '0';                              
                                                \
                                scale--;                                        
                                                        \
                        }                                                       
                                                                \
-                       while(*s && isdigit((unsigned char) *s))                
                        \
-                               s++;                                            
                                                        \
                }                                                               
                                                                \
                while(*s && isspace((unsigned char) *s))                        
                        \
                        s++;                                                    
                                                        \
diff --git 
a/sql/test/BugTracker-2020/Tests/copy-decimal-with-space.Bug-6917.sql 
b/sql/test/BugTracker-2020/Tests/copy-decimal-with-space.Bug-6917.sql
--- a/sql/test/BugTracker-2020/Tests/copy-decimal-with-space.Bug-6917.sql
+++ b/sql/test/BugTracker-2020/Tests/copy-decimal-with-space.Bug-6917.sql
@@ -1,6 +1,6 @@
 start transaction;
 create table tmpcopy(i integer, d decimal(8,3));
-copy 10 records into tmpcopy from stdin delimiters ',','\n' best effort;
+copy 10 records into tmpcopy from stdin delimiters ',','\n';
 0,1.2
 0,2.34
  0,3.456
@@ -12,4 +12,7 @@ 0,5
 0,67 
 0,890
 select * from tmpcopy;
+-- and too many digits (should fail)
+copy 1 records into tmpcopy from stdin delimiters ',','\n';
+0,12.3456
 rollback;
diff --git 
a/sql/test/BugTracker-2020/Tests/copy-decimal-with-space.Bug-6917.stable.err 
b/sql/test/BugTracker-2020/Tests/copy-decimal-with-space.Bug-6917.stable.err
--- a/sql/test/BugTracker-2020/Tests/copy-decimal-with-space.Bug-6917.stable.err
+++ b/sql/test/BugTracker-2020/Tests/copy-decimal-with-space.Bug-6917.stable.err
@@ -5,6 +5,11 @@ stderr of test 'copy-decimal-with-space.
 # 09:14:25 >  "mclient" "-lsql" "-ftest" "-tnone" "-Eutf-8" "-i" "-e" 
"--host=/var/tmp/mtest-97497" "--port=32609"
 # 09:14:25 >  
 
+MAPI  = (monetdb) /var/tmp/mtest-1786006/.s.monetdb.39956
+QUERY = copy 1 records into tmpcopy from stdin delimiters ',','\n';
+        0,12.3456
+ERROR = !Failed to import table 'tmpcopy', line 1 field d 'decimal(8,3)' 
expected in '12.3456'
+CODE  = 42000
 
 # 09:14:25 >  
 # 09:14:25 >  "Done."
_______________________________________________
checkin-list mailing list
[email protected]
https://www.monetdb.org/mailman/listinfo/checkin-list

Reply via email to