Changeset: 41f6cf73a38a for MonetDB URL: https://dev.monetdb.org/hg/MonetDB?cmd=changeset;node=41f6cf73a38a Modified Files: sql/backends/monet5/sql_result.c sql/backends/monet5/sql_upgrades.c Branch: unlock Log Message:
merged diffs (truncated from 3147 to 300 lines): diff --git a/gdk/gdk_utils.c b/gdk/gdk_utils.c --- a/gdk/gdk_utils.c +++ b/gdk/gdk_utils.c @@ -1058,7 +1058,7 @@ GDKreset(int status) for (Thread t = GDKthreads; t < GDKthreads + THREADS; t++) { MT_Id victim; if ((victim = (MT_Id) ATOMIC_GET(&t->pid)) != 0) { - if (victim != pid) { + if (pid && victim != pid) { int e; killed = true; 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/backends/monet5/sql_upgrades.c b/sql/backends/monet5/sql_upgrades.c --- a/sql/backends/monet5/sql_upgrades.c +++ b/sql/backends/monet5/sql_upgrades.c @@ -1935,7 +1935,7 @@ sql_update_jun2020_sp1_hugeint(Client c, #endif static str -sql_update_default_lidar(Client c) +sql_update_oscar_lidar(Client c) { char *query = "drop procedure sys.lidarattach(string);\n" @@ -1946,7 +1946,7 @@ sql_update_default_lidar(Client c) } static str -sql_update_default(Client c, mvc *sql, const char *prev_schema, bool *systabfixed) +sql_update_oscar(Client c, mvc *sql, const char *prev_schema, bool *systabfixed) { size_t bufsize = 8192, pos = 0; char *err = NULL, *buf = GDKmalloc(bufsize); @@ -2047,13 +2047,20 @@ sql_update_default(Client c, mvc *sql, c "external name \"sql\".\"sql_variables\";\n" "grant execute on function \"sys\".\"var\" to public;\n"); + pos += snprintf(buf + pos, bufsize - pos, + "create procedure sys.hot_snapshot(tarfile string, onserver bool)\n" + "external name sql.hot_snapshot;\n" + "update sys.functions set system = true where system <> true and schema_id = (select id from sys.schemas where name = 'sys')" + " and name in ('hot_snapshot') and type = %d;\n", + (int) F_PROC); /* .snapshot user */ pos += snprintf(buf + pos, bufsize - pos, - "create user \".snapshot\"" - " with encrypted password '00000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000'" - " name 'Snapshot User'" + "create user \".snapshot\"\n" + " with encrypted password '00000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000'\n" + " name 'Snapshot User'\n" " schema sys;\n" - "grant execute on procedure sys.hot_snapshot to \".snapshot\";\n" + "grant execute on procedure sys.hot_snapshot(string) to \".snapshot\";\n" + "grant execute on procedure sys.hot_snapshot(string, bool) to \".snapshot\";\n" ); /* additional snapshot function */ @@ -2085,13 +2092,6 @@ sql_update_default(Client c, mvc *sql, c /* Move sys.degrees and sys.radians to sql_types.c definitions (I did this at the bat_logger) Remove the obsolete entries at privileges table */ pos += snprintf(buf + pos, bufsize - pos, "delete from privileges where obj_id in (select obj_id from privileges left join functions on privileges.obj_id = functions.id where functions.id is null and privileges.obj_id not in ((SELECT tables.id from tables), 0));\n"); - /* Remove sql_add and sql_sub between interval and numeric types */ - pos += snprintf(buf + pos, bufsize - pos, - "delete from functions where name in ('sql_sub','sql_add') and func in ('+','-') and id in (select func_id from args where name = 'res_0' and type in ('sec_interval','month_interval'));\n"); - /* Remove arguments with no function correspondent */ - pos += snprintf(buf + pos, bufsize - pos, - "delete from args where id in (select args.id from args left join functions on args.func_id = functions.id where functions.id is null);\n"); - pos += snprintf(buf + pos, bufsize - pos, "UPDATE sys.functions set semantics = false WHERE (name, func) IN (VALUES \n" "('length', 'nitems'),\n" @@ -2216,7 +2216,8 @@ sql_update_default(Client c, mvc *sql, c "('octet_length', 'nbytes'),\n" "('soundex', 'soundex'),\n" "('qgramnormalize', 'qgramnormalize')\n" - ");\n"); + ") and type <> %d;\n", + F_ANALYTIC); pos += snprintf(buf + pos, bufsize - pos, "set schema \"%s\";\n", prev_schema); assert(pos < bufsize); @@ -2410,14 +2411,14 @@ SQLupgrades(Client c, mvc *m) sql_find_subtype(&tp, "varchar", 0, 0); if (sql_bind_func(m->sa, s, "lidarattach", &tp, NULL, F_PROC) && - (err = sql_update_default_lidar(c)) != NULL) { + (err = sql_update_oscar_lidar(c)) != NULL) { TRC_CRITICAL(SQL_PARSER, "%s\n", err); freeException(err); GDKfree(prev_schema); return -1; } - if ((err = sql_update_default(c, m, prev_schema, &systabfixed)) != NULL) { + if ((err = sql_update_oscar(c, m, prev_schema, &systabfixed)) != NULL) { TRC_CRITICAL(SQL_PARSER, "%s\n", err); freeException(err); GDKfree(prev_schema); 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." diff --git a/sql/test/emptydb-upgrade-chain-hge/Tests/upgrade.stable.out.int128 b/sql/test/emptydb-upgrade-chain-hge/Tests/upgrade.stable.out.int128 --- a/sql/test/emptydb-upgrade-chain-hge/Tests/upgrade.stable.out.int128 +++ b/sql/test/emptydb-upgrade-chain-hge/Tests/upgrade.stable.out.int128 @@ -5769,20 +5769,145 @@ update sys._tables set system = true whe drop function "sys"."var"(); create function "sys"."var"() returns table("schema" string, "name" string, "type" string, "value" string) external name "sql"."sql_variables"; grant execute on function "sys"."var" to public; -create user ".snapshot" with encrypted password '00000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000' name 'Snapshot User' schema sys;grant execute on procedure sys.hot_snapshot to ".snapshot";update sys.functions set system = true, language = 2, side_effect = false where name = 'var' and schema_id = (select id from sys.schemas where name = 'sys') and type = 5; +create procedure sys.hot_snapshot(tarfile string, onserver bool) +external name sql.hot_snapshot; +update sys.functions set system = true where system <> true and schema_id = (select id from sys.schemas where name = 'sys') and name in ('hot_snapshot') and type = 2; +create user ".snapshot" + with encrypted password '00000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000' + name 'Snapshot User' + schema sys; +grant execute on procedure sys.hot_snapshot(string) to ".snapshot"; +grant execute on procedure sys.hot_snapshot(string, bool) to ".snapshot"; +update sys.functions set system = true, language = 2, side_effect = false where name = 'var' and schema_id = (select id from sys.schemas where name = 'sys') and type = 5; update sys.args set type = 'char' where func_id = (select id from sys.functions where name = 'var' and schema_id = (select id from sys.schemas where name = 'sys') and type = 5) and type = 'clob'; update sys.privileges set grantor = 0 where obj_id = (select id from sys.functions where name = 'var' and schema_id = (select id from sys.schemas where name = 'sys') and type = 5); DROP FUNCTION "sys"."getcontent"(url); DROP AGGREGATE "json"."output"(json); delete from privileges where obj_id in (select obj_id from privileges left join functions on privileges.obj_id = functions.id where functions.id is null and privileges.obj_id not in ((SELECT tables.id from tables), 0)); -delete from functions where name in ('sql_sub','sql_add') and func in ('+','-') and id in (select func_id from args where name = 'res_0' and type in ('sec_interval','month_interval')); -delete from args where id in (select args.id from args left join functions on args.func_id = functions.id where functions.id is null); -update sys.functions set semantics = false where type <> 6 and ((func not ilike '%CREATE FUNCTION%' and name in ('length','octet_length','>','>=','<','<=','min','max','sql_min','sql_max','least','greatest','sum','prod','mod','and', -'xor','not','sql_mul','sql_div','sql_sub','sql_add','bit_and','bit_or','bit_xor','bit_not','left_shift','right_shift','abs','sign','scale_up','scale_down','round','power','floor','ceil','ceiling','sin','cos','tan','asin', -'acos','atan','sinh','cot','cosh','tanh','sqrt','exp','log','ln','log10','log2','pi','curdate','current_date','curtime','current_time','current_timestamp','localtime','localtimestamp','local_timezone','century','decade','year', -'quarter','month','day','dayofyear','weekofyear','dayofweek','dayofmonth','week','hour','minute','second','strings','locate','charindex','splitpart','substring','substr','truncate','concat','ascii','code','right','left','upper', -'ucase','lower','lcase','trim','ltrim','rtrim','lpad','rpad','insert','replace','repeat','space','char_length','character_length','soundex','qgramnormalize','degrees','radians')) or -(system = true and name in ('like','ilike','str_to_date','date_to_str','str_to_time','time_to_str','str_to_timestamp','timestamp_to_str','date_trunc','epoch','reverse'))); +UPDATE sys.functions set semantics = false WHERE (name, func) IN (VALUES +('length', 'nitems'), +('octet_length', 'nitems'), +('>', '>'), +('>=', '>='), +('<', '<'), +('<=', '<='), +('min', 'min'), +('max', 'max'), +('sql_min', 'min'), +('sql_max', 'max'), +('least', 'min_no_nil'), +('greatest', 'max_no_nil'), +('sum', 'sum'), +('prod', 'prod'), +('mod', '%'), +('and', 'and'), +('xor', 'xor'), +('not', 'not'), +('sql_mul', '*'), +('sql_div', '/'), +('sql_sub', '-'), +('sql_add', '+'), +('bit_and', 'and'), +('bit_or', 'or'), +('bit_xor', 'xor'), +('bit_not', 'not'), +('left_shift', '<<'), +('right_shift', '>>'), +('abs', 'abs'), +('sign', 'sign'), +('scale_up', '*'), +('scale_down', 'dec_round'), +('round', 'round'), +('power', 'pow'), +('floor', 'floor'), +('ceil', 'ceil'), +('ceiling', 'ceil'), +('sin', 'sin'), +('cos', 'cos'), +('tan', 'tan'), +('asin', 'asin'), +('acos', 'acos'), +('atan', 'atan'), +('atan', 'atan2'), +('sinh', 'sinh'), +('cot', 'cot'), +('cosh', 'cosh'), +('tanh', 'tanh'), +('sqrt', 'sqrt'), +('exp', 'exp'), +('log', 'log'), +('ln', 'log'), +('log10', 'log10'), +('log2', 'log2'), +('degrees', 'degrees'), +('radians', 'radians'), +('pi', 'pi'), +('curdate', 'current_date'), +('current_date', 'current_date'), +('curtime', 'current_time'), +('current_time', 'current_time'), +('current_timestamp', 'current_timestamp'), +('localtime', 'current_time'), +('localtimestamp', 'current_timestamp'), +('sql_sub', 'diff'), +('sql_sub', 'date_sub_msec_interval'), +('sql_sub', 'date_sub_month_interval'), +('sql_sub', 'time_sub_msec_interval'), +('sql_sub', 'timestamp_sub_msec_interval'), +('sql_sub', 'timestamp_sub_month_interval'), +('sql_add', 'date_add_msec_interval'), +('sql_add', 'addmonths'), +('sql_add', 'timestamp_add_msec_interval'), +('sql_add', 'timestamp_add_month_interval'), +('sql_add', 'time_add_msec_interval'), +('local_timezone', 'local_timezone'), +('century', 'century'), +('decade', 'decade'), +('year', 'year'), +('quarter', 'quarter'), +('month', 'month'), +('day', 'day'), +('dayofyear', 'dayofyear'), +('weekofyear', 'weekofyear'), +('dayofweek', 'dayofweek'), +('dayofmonth', 'day'), +('week', 'weekofyear'), +('hour', 'hours'), +('minute', 'minutes'), +('second', 'sql_seconds'), +('second', 'seconds'), +('strings', 'strings'), +('locate', 'locate'), +('charindex', 'locate'), +('splitpart', 'splitpart'), +('substring', 'substring'), +('substr', 'substring'), +('truncate', 'stringleft'), +('concat', '+'), +('ascii', 'ascii'), +('code', 'unicode'), +('length', 'length'), +('right', 'stringright'), +('left', 'stringleft'), +('upper', 'toUpper'), +('ucase', 'toUpper'), +('lower', 'toLower'), +('lcase', 'toLower'), +('trim', 'trim'), +('ltrim', 'ltrim'), +('rtrim', 'rtrim'), +('lpad', 'lpad'), +('rpad', 'rpad'), +('insert', 'insert'), +('replace', 'replace'), +('repeat', 'repeat'), +('space', 'space'), +('char_length', 'length'), +('character_length', 'length'), +('octet_length', 'nbytes'), +('soundex', 'soundex'), +('qgramnormalize', 'qgramnormalize') +) and type <> 6; _______________________________________________ checkin-list mailing list checkin-list@monetdb.org https://www.monetdb.org/mailman/listinfo/checkin-list