Changeset: 362c555dffad for MonetDB
URL: http://dev.monetdb.org/hg/MonetDB?cmd=changeset;node=362c555dffad
Added Files:
sql/test/BugTracker-2014/Tests/duplicate_primary_keys.Bug-3474.stable.err
sql/test/BugTracker-2014/Tests/duplicate_primary_keys.Bug-3474.stable.out
Modified Files:
monetdb5/modules/mal/mkey.c
Branch: Oct2014
Log Message:
make sure we use the correct atom hash function for external types.
Fixes bug 3474, a cleanup of all the hash functions is still needed
diffs (138 lines):
diff --git a/monetdb5/modules/mal/mkey.c b/monetdb5/modules/mal/mkey.c
--- a/monetdb5/modules/mal/mkey.c
+++ b/monetdb5/modules/mal/mkey.c
@@ -130,7 +130,7 @@ voidbathash(BAT **res, BAT *b )
char *v = BUNtail(bi,BUNfirst(b)), *e = BUNtail(bi,BUNlast(b));
int sz = Tsize(b), tpe = b->ttype;
- switch (ATOMstorage(tpe)) {
+ switch (tpe) {
case TYPE_bte:
for(; v < e; v+=sz)
*r++ = *(bte*)v;
@@ -238,7 +238,7 @@ CMDconstbulk_rotate_xor_hash(BAT **res,
BAT* br = NULL;
BATiter bi = bat_iterator(b);
wrd *dst = NULL;
- int tpe = ATOMstorage(b->ttype);
+ int tpe = b->ttype;
int lbit = *rotate;
int rbit = (sizeof(wrd)*8) - *rotate;
wrd mask = (((wrd)1) << lbit) - 1;
@@ -431,7 +431,7 @@ CMDbulk_rotate_xor_hash(BAT **res, BAT *
BATiter bi = bat_iterator(b);
wrd *src = (wrd *) Tloc(bn, BUNfirst(bn));
wrd *dst = NULL;
- int tpe = ATOMstorage(b->ttype);
+ int tpe = b->ttype;
int lbit = *rotate;
int rbit = (sizeof(wrd)*8) - *rotate;
wrd mask = (((wrd)1) << lbit) - 1;
@@ -589,6 +589,7 @@ MKEYhash(Client cntxt, MalBlkPtr mb, Mal
(void) cntxt;
ret= getArgReference_wrd(stk,p,0);
val= getArgReference(stk,p,1);
+ assert (tpe >= TYPE_str);
if (ATOMextern(tpe))
val = *(ptr*)val;
else if (tpe == TYPE_str)
diff --git
a/sql/test/BugTracker-2014/Tests/duplicate_primary_keys.Bug-3474.stable.err
b/sql/test/BugTracker-2014/Tests/duplicate_primary_keys.Bug-3474.stable.err
new file mode 100644
--- /dev/null
+++ b/sql/test/BugTracker-2014/Tests/duplicate_primary_keys.Bug-3474.stable.err
@@ -0,0 +1,43 @@
+stderr of test 'duplicate_primary_keys.Bug-3474` in directory
'sql/test/BugTracker-2014` itself:
+
+
+# 14:51:58 >
+# 14:51:58 > "mserver5" "--debug=10" "--set" "gdk_nr_threads=0" "--set"
"mapi_open=true" "--set" "mapi_port=38963" "--set"
"mapi_usock=/var/tmp/mtest-5565/.s.monetdb.38963" "--set" "monet_prompt="
"--forcemito" "--set" "mal_listing=2"
"--dbpath=/home/niels/scratch/rc-monetdb/Linux-x86_64/var/MonetDB/mTests_sql_test_BugTracker-2014"
"--set" "mal_listing=0" "--set" "embedded_r=yes"
+# 14:51:58 >
+
+# builtin opt gdk_dbpath =
/home/niels/scratch/rc-monetdb/Linux-x86_64/var/monetdb5/dbfarm/demo
+# builtin opt gdk_debug = 0
+# builtin opt gdk_vmtrim = no
+# 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 = 38963
+# cmdline opt mapi_usock = /var/tmp/mtest-5565/.s.monetdb.38963
+# cmdline opt monet_prompt =
+# cmdline opt mal_listing = 2
+# cmdline opt gdk_dbpath =
/home/niels/scratch/rc-monetdb/Linux-x86_64/var/MonetDB/mTests_sql_test_BugTracker-2014
+# cmdline opt mal_listing = 0
+# cmdline opt embedded_r = yes
+# cmdline opt gdk_debug = 536870922
+
+# 14:51:59 >
+# 14:51:59 > "mclient" "-lsql" "-ftest" "-Eutf-8" "-i" "-e"
"--host=/var/tmp/mtest-5565" "--port=38963"
+# 14:51:59 >
+
+MAPI = (monetdb) /var/tmp/mtest-5565/.s.monetdb.38963
+QUERY = insert into x values ('FIAM','HHZ', '2010-04-25T14:00:00.000');
+ERROR = !INSERT INTO: PRIMARY KEY constraint 'x.x_a_b_c_pkey' violated
+MAPI = (monetdb) /var/tmp/mtest-5565/.s.monetdb.38963
+QUERY = insert into x (select * from y);
+ERROR = !INSERT INTO: PRIMARY KEY constraint 'x.x_a_b_c_pkey' violated
+
+# 14:51:59 >
+# 14:51:59 > "Done."
+# 14:51:59 >
+
diff --git
a/sql/test/BugTracker-2014/Tests/duplicate_primary_keys.Bug-3474.stable.out
b/sql/test/BugTracker-2014/Tests/duplicate_primary_keys.Bug-3474.stable.out
new file mode 100644
--- /dev/null
+++ b/sql/test/BugTracker-2014/Tests/duplicate_primary_keys.Bug-3474.stable.out
@@ -0,0 +1,47 @@
+stdout of test 'duplicate_primary_keys.Bug-3474` in directory
'sql/test/BugTracker-2014` itself:
+
+
+# 14:51:58 >
+# 14:51:58 > "mserver5" "--debug=10" "--set" "gdk_nr_threads=0" "--set"
"mapi_open=true" "--set" "mapi_port=38963" "--set"
"mapi_usock=/var/tmp/mtest-5565/.s.monetdb.38963" "--set" "monet_prompt="
"--forcemito" "--set" "mal_listing=2"
"--dbpath=/home/niels/scratch/rc-monetdb/Linux-x86_64/var/MonetDB/mTests_sql_test_BugTracker-2014"
"--set" "mal_listing=0" "--set" "embedded_r=yes"
+# 14:51:58 >
+
+# MonetDB 5 server v11.19.0
+# This is an unreleased version
+# Serving database 'mTests_sql_test_BugTracker-2014', using 4 threads
+# Compiled for x86_64-unknown-linux-gnu/64bit with 64bit OIDs dynamically
linked
+# Found 7.334 GiB available main-memory.
+# Copyright (c) 1993-July 2008 CWI.
+# Copyright (c) August 2008-2014 MonetDB B.V., all rights reserved
+# Visit http://www.monetdb.org/ for further information
+# Listening for connection requests on mapi:monetdb://localhost.nes.nl:38963/
+# Listening for UNIX domain connection requests on
mapi:monetdb:///var/tmp/mtest-5565/.s.monetdb.38963
+# MonetDB/GIS module loaded
+# MonetDB/SQL module loaded
+# MonetDB/R module loaded
+
+Ready.
+
+# 14:51:59 >
+# 14:51:59 > "mclient" "-lsql" "-ftest" "-Eutf-8" "-i" "-e"
"--host=/var/tmp/mtest-5565" "--port=38963"
+# 14:51:59 >
+
+#create table x ( a clob, b clob, c timestamp);
+#alter table x add primary key (a,b,c);
+#create table y ( a clob, b clob, c timestamp);
+#insert into y values ('FIAM','HHZ', '2010-04-25T14:00:00.000');
+[ 1 ]
+#insert into x (select * from y);
+[ 1 ]
+#select * from x;
+% sys.x, sys.x, sys.x # table_name
+% a, b, c # name
+% clob, clob, timestamp # type
+% 4, 3, 26 # length
+[ "FIAM", "HHZ", 2010-04-25 14:00:00.000000 ]
+#drop table x;
+#drop table y;
+
+# 14:51:59 >
+# 14:51:59 > "Done."
+# 14:51:59 >
+
_______________________________________________
checkin-list mailing list
[email protected]
https://www.monetdb.org/mailman/listinfo/checkin-list