Changeset: 56d4b61c2a05 for MonetDB
URL: https://dev.monetdb.org/hg/MonetDB/rev/56d4b61c2a05
Modified Files:
        sql/backends/monet5/sql_bincopyconvert.c
Branch: Aug2024
Log Message:

Don't check width of nil: it fits always.


diffs (44 lines):

diff --git a/sql/backends/monet5/sql_bincopyconvert.c 
b/sql/backends/monet5/sql_bincopyconvert.c
--- a/sql/backends/monet5/sql_bincopyconvert.c
+++ b/sql/backends/monet5/sql_bincopyconvert.c
@@ -368,25 +368,25 @@ load_zero_terminated_text(BAT *bat, stre
                                goto end;
                        }
                        if (tpe == TYPE_str) {
-                                       if (width > 0) {
-                                               int w = UTF8_strlen(start);
-                                               if (w > width) {
-                                                       msg = 
createException(SQL, "sql.importColumn", "string too wide for column");
-                                                       goto end;
-                                               }
+                               if (width > 0 && !strNil(start)) {
+                                       int w = UTF8_strlen(start);
+                                       if (w > width) {
+                                               msg = createException(SQL, 
"sql.importColumn", "string too wide for column");
+                                               goto end;
                                        }
-                                       value = start;
+                               }
+                               value = start;
                        } else {
-                                       ssize_t n = ATOMfromstr(tpe, &buffer, 
&buffer_len, start, false);
-                                       if (n <= 0) {
-                                                       msg = 
createException(SQL, "sql.importColumn", GDK_EXCEPTION);
-                                                       goto end;
-                                       }
-                                       value = buffer;
+                               ssize_t n = ATOMfromstr(tpe, &buffer, 
&buffer_len, start, false);
+                               if (n <= 0) {
+                                       msg = createException(SQL, 
"sql.importColumn", GDK_EXCEPTION);
+                                       goto end;
+                               }
+                               value = buffer;
                        }
                        if (BUNappend(bat, value, false) != GDK_SUCCEED) {
-                                       msg = createException(SQL, 
"sql.importColumn", GDK_EXCEPTION);
-                                       goto end;
+                               msg = createException(SQL, "sql.importColumn", 
GDK_EXCEPTION);
+                               goto end;
                        }
                }
                bs->pos = start - buf_start;
_______________________________________________
checkin-list mailing list -- checkin-list@monetdb.org
To unsubscribe send an email to checkin-list-le...@monetdb.org

Reply via email to