Changeset: 103905391bc5 for MonetDB
URL: https://dev.monetdb.org/hg/MonetDB?cmd=changeset;node=103905391bc5
Modified Files:
        sql/backends/monet5/sql_statement.c
        sql/server/rel_select.c
        
sql/test/BugTracker-2016/Tests/convert-function-test-hge.Bug-3460.stable.out.int128
        sql/test/BugTracker-2016/Tests/convert-function-test.Bug-3460.stable.out
        
sql/test/BugTracker-2016/Tests/convert-function-test.Bug-3460.stable.out.int128
Branch: mtime
Log Message:

Merge with default branch.


diffs (235 lines):

diff --git a/sql/backends/monet5/sql_statement.c 
b/sql/backends/monet5/sql_statement.c
--- a/sql/backends/monet5/sql_statement.c
+++ b/sql/backends/monet5/sql_statement.c
@@ -2750,7 +2750,13 @@ stmt_convert(backend *be, stmt *v, sql_s
        if (v->nr < 0)
                return NULL;
 
-       if (t->type->localtype == f->type->localtype && (t->type->eclass == 
f->type->eclass || (EC_VARCHAR(f->type->eclass) && 
EC_VARCHAR(t->type->eclass))) && !EC_INTERVAL(f->type->eclass) && 
f->type->eclass != EC_DEC && (t->digits == 0 || f->digits == t->digits)) {
+       if (t->type->localtype == f->type->localtype &&
+           (t->type->eclass == f->type->eclass ||
+            (EC_VARCHAR(f->type->eclass) && EC_VARCHAR(t->type->eclass))) &&
+           !EC_INTERVAL(f->type->eclass) &&
+           f->type->eclass != EC_DEC &&
+           (t->digits == 0 || f->digits == t->digits) &&
+           type_has_tz(t) == type_has_tz(f)) {
                return v;
        }
 
diff --git a/sql/server/rel_select.c b/sql/server/rel_select.c
--- a/sql/server/rel_select.c
+++ b/sql/server/rel_select.c
@@ -2691,6 +2691,7 @@ rel_in_exp(sql_query *query, sql_rel *re
 
                        r = rel_value_exp(query, &z, n->data.sym, f /* ie no 
result project */, ek);
                        if (!r) {
+                               sql_rel *oleft = left;
                                /* reset error */
                                sql->session->status = 0;
                                sql->errstr[0] = 0;
@@ -2698,6 +2699,8 @@ rel_in_exp(sql_query *query, sql_rel *re
                                r = rel_value_exp(query, &left, n->data.sym, f 
/* ie no result project */, ek);
                                if (r)
                                        l_used = is_join(left->op);
+                               if (oleft != left)
+                                       l_outer = 1;
                        }
                        if (!r) {
                                /* reset error */
@@ -2758,12 +2761,13 @@ rel_in_exp(sql_query *query, sql_rel *re
                                        }
                                        if (rel_convert_types(sql, &l, &r, 1, 
type_equal_no_any) < 0) 
                                                return NULL;
-                                       r = exp_compare(sql->sa, l, r, 
sc->token==SQL_IN?mark_in:mark_notin); 
+                                       r = exp_compare(sql->sa, l, r, 
(z||l_outer)?(sc->token==SQL_IN?mark_in:mark_notin):
+                                                                        
(sc->token==SQL_IN?cmp_equal:cmp_notequal)); 
                                        if (z) {
                                                left = 
rel_crossproduct(sql->sa, left, z, sc->token==SQL_IN?op_semi:op_anti);
                                                if (rel_has_freevar(z))
                                                        set_dependent(left);
-                                       } else {
+                                       } else if (l_outer) {
                                                left->op = 
sc->token==SQL_IN?op_semi:op_anti;
                                        }
                                        rel_join_add_exp(sql->sa, left, r);
diff --git 
a/sql/test/BugTracker-2016/Tests/convert-function-test-hge.Bug-3460.stable.out.int128
 
b/sql/test/BugTracker-2016/Tests/convert-function-test-hge.Bug-3460.stable.out.int128
--- 
a/sql/test/BugTracker-2016/Tests/convert-function-test-hge.Bug-3460.stable.out.int128
+++ 
b/sql/test/BugTracker-2016/Tests/convert-function-test-hge.Bug-3460.stable.out.int128
@@ -16,9 +16,6 @@ stdout of test 'convert-function-test-hg
 # Listening for connection requests on mapi:monetdb://toulouse.da.cwi.nl:36439/
 # Listening for UNIX domain connection requests on 
mapi:monetdb:///var/tmp/mtest-11655/.s.monetdb.36439
 # MonetDB/GIS module loaded
-# MonetDB/SQL module loaded
-# MonetDB/R   module loaded
-
 # SQL catalog created, loading sql scripts once
 # loading sql script: 09_like.sql
 # loading sql script: 10_math.sql
@@ -58,6 +55,9 @@ stdout of test 'convert-function-test-hg
 # loading sql script: 90_generator.sql
 # loading sql script: 90_generator_hge.sql
 # loading sql script: 99_system.sql
+# MonetDB/SQL module loaded
+
+Ready.
 
 # 19:15:22 >  
 # 19:15:22 >  "mclient" "-lsql" "-ftest" "-Eutf-8" "-i" "-e" 
"--host=/var/tmp/mtest-11655" "--port=36439"
diff --git 
a/sql/test/BugTracker-2016/Tests/convert-function-test.Bug-3460.stable.out 
b/sql/test/BugTracker-2016/Tests/convert-function-test.Bug-3460.stable.out
--- a/sql/test/BugTracker-2016/Tests/convert-function-test.Bug-3460.stable.out
+++ b/sql/test/BugTracker-2016/Tests/convert-function-test.Bug-3460.stable.out
@@ -6863,12 +6863,12 @@ stdout of test 'convert-function-test.Bu
 #SELECT v, convert(v, timestamp with time zone) from T_timestamp;
 % sys.t_timestamp,     sys.L3 # table_name
 % v,   L3 # name
-% timestamp,   timestamp # type
-% 26,  26 # length
-[ 1999-12-31 23:59:59.000000,  1999-12-31 23:59:59.000000      ]
-[ 2016-01-01 00:00:00.000000,  2016-01-01 00:00:00.000000      ]
-[ 2016-02-29 00:00:00.000000,  2016-02-29 00:00:00.000000      ]
-[ 2016-12-31 23:59:58.000000,  2016-12-31 23:59:58.000000      ]
+% timestamp,   timestamptz # type
+% 26,  32 # length
+[ 1999-12-31 23:59:59.000000,  2000-01-01 01:59:59.000000+02:00        ]
+[ 2016-01-01 00:00:00.000000,  2016-01-01 02:00:00.000000+02:00        ]
+[ 2016-02-29 00:00:00.000000,  2016-02-29 02:00:00.000000+02:00        ]
+[ 2016-12-31 23:59:58.000000,  2017-01-01 01:59:58.000000+02:00        ]
 [ NULL,        NULL    ]
 #SELECT v, cast(v as varchar(36)) from T_timestamp;
 % sys.t_timestamp,     sys.L3 # table_name
@@ -6943,12 +6943,12 @@ stdout of test 'convert-function-test.Bu
 #SELECT v, cast(v as timestamp with time zone) from T_timestamp;
 % sys.t_timestamp,     sys.L3 # table_name
 % v,   L3 # name
-% timestamp,   timestamp # type
-% 26,  26 # length
-[ 1999-12-31 23:59:59.000000,  1999-12-31 23:59:59.000000      ]
-[ 2016-01-01 00:00:00.000000,  2016-01-01 00:00:00.000000      ]
-[ 2016-02-29 00:00:00.000000,  2016-02-29 00:00:00.000000      ]
-[ 2016-12-31 23:59:58.000000,  2016-12-31 23:59:58.000000      ]
+% timestamp,   timestamptz # type
+% 26,  32 # length
+[ 1999-12-31 23:59:59.000000,  2000-01-01 01:59:59.000000+02:00        ]
+[ 2016-01-01 00:00:00.000000,  2016-01-01 02:00:00.000000+02:00        ]
+[ 2016-02-29 00:00:00.000000,  2016-02-29 02:00:00.000000+02:00        ]
+[ 2016-12-31 23:59:58.000000,  2017-01-01 01:59:58.000000+02:00        ]
 [ NULL,        NULL    ]
 #DROP TABLE T_timestamp;
 #CREATE TABLE T_timetz (v TIMETZ);
@@ -7113,12 +7113,12 @@ stdout of test 'convert-function-test.Bu
 #SELECT v, convert(v, timestamp) from T_timestamptz;
 % sys.t_timestamptz,   sys.L3 # table_name
 % v,   L3 # name
-% timestamptz, timestamptz # type
-% 32,  32 # length
-[ 2000-01-01 01:59:59.000000+02:00,    2000-01-01 01:59:59.000000+02:00        
]
-[ 2016-01-01 02:00:00.000000+02:00,    2016-01-01 02:00:00.000000+02:00        
]
-[ 2016-02-29 02:00:00.000000+02:00,    2016-02-29 02:00:00.000000+02:00        
]
-[ 2017-01-01 01:59:58.000000+02:00,    2017-01-01 01:59:58.000000+02:00        
]
+% timestamptz, timestamp # type
+% 32,  26 # length
+[ 2000-01-01 01:59:59.000000+02:00,    1999-12-31 23:59:59.000000      ]
+[ 2016-01-01 02:00:00.000000+02:00,    2016-01-01 00:00:00.000000      ]
+[ 2016-02-29 02:00:00.000000+02:00,    2016-02-29 00:00:00.000000      ]
+[ 2017-01-01 01:59:58.000000+02:00,    2016-12-31 23:59:58.000000      ]
 [ NULL,        NULL    ]
 #SELECT v, convert(v, timetz) from T_timestamptz;
 % sys.t_timestamptz,   sys.L3 # table_name
@@ -7193,12 +7193,12 @@ stdout of test 'convert-function-test.Bu
 #SELECT v, cast(v as timestamp) from T_timestamptz;
 % sys.t_timestamptz,   sys.L3 # table_name
 % v,   L3 # name
-% timestamptz, timestamptz # type
-% 32,  32 # length
-[ 2000-01-01 01:59:59.000000+02:00,    2000-01-01 01:59:59.000000+02:00        
]
-[ 2016-01-01 02:00:00.000000+02:00,    2016-01-01 02:00:00.000000+02:00        
]
-[ 2016-02-29 02:00:00.000000+02:00,    2016-02-29 02:00:00.000000+02:00        
]
-[ 2017-01-01 01:59:58.000000+02:00,    2017-01-01 01:59:58.000000+02:00        
]
+% timestamptz, timestamp # type
+% 32,  26 # length
+[ 2000-01-01 01:59:59.000000+02:00,    1999-12-31 23:59:59.000000      ]
+[ 2016-01-01 02:00:00.000000+02:00,    2016-01-01 00:00:00.000000      ]
+[ 2016-02-29 02:00:00.000000+02:00,    2016-02-29 00:00:00.000000      ]
+[ 2017-01-01 01:59:58.000000+02:00,    2016-12-31 23:59:58.000000      ]
 [ NULL,        NULL    ]
 #SELECT v, cast(v as timetz) from T_timestamptz;
 % sys.t_timestamptz,   sys.L3 # table_name
diff --git 
a/sql/test/BugTracker-2016/Tests/convert-function-test.Bug-3460.stable.out.int128
 
b/sql/test/BugTracker-2016/Tests/convert-function-test.Bug-3460.stable.out.int128
--- 
a/sql/test/BugTracker-2016/Tests/convert-function-test.Bug-3460.stable.out.int128
+++ 
b/sql/test/BugTracker-2016/Tests/convert-function-test.Bug-3460.stable.out.int128
@@ -7203,12 +7203,12 @@ stdout of test 'convert-function-test.Bu
 #SELECT v, convert(v, timestamp with time zone) from T_timestamp;
 % sys.t_timestamp,     sys.L3 # table_name
 % v,   L3 # name
-% timestamp,   timestamp # type
-% 26,  26 # length
-[ 1999-12-31 23:59:59.000000,  1999-12-31 23:59:59.000000      ]
-[ 2016-01-01 00:00:00.000000,  2016-01-01 00:00:00.000000      ]
-[ 2016-02-29 00:00:00.000000,  2016-02-29 00:00:00.000000      ]
-[ 2016-12-31 23:59:58.000000,  2016-12-31 23:59:58.000000      ]
+% timestamp,   timestamptz # type
+% 26,  32 # length
+[ 1999-12-31 23:59:59.000000,  2000-01-01 01:59:59.000000+02:00        ]
+[ 2016-01-01 00:00:00.000000,  2016-01-01 02:00:00.000000+02:00        ]
+[ 2016-02-29 00:00:00.000000,  2016-02-29 02:00:00.000000+02:00        ]
+[ 2016-12-31 23:59:58.000000,  2017-01-01 01:59:58.000000+02:00        ]
 [ NULL,        NULL    ]
 #SELECT v, cast(v as varchar(36)) from T_timestamp;
 % sys.t_timestamp,     sys.L3 # table_name
@@ -7283,12 +7283,12 @@ stdout of test 'convert-function-test.Bu
 #SELECT v, cast(v as timestamp with time zone) from T_timestamp;
 % sys.t_timestamp,     sys.L3 # table_name
 % v,   L3 # name
-% timestamp,   timestamp # type
-% 26,  26 # length
-[ 1999-12-31 23:59:59.000000,  1999-12-31 23:59:59.000000      ]
-[ 2016-01-01 00:00:00.000000,  2016-01-01 00:00:00.000000      ]
-[ 2016-02-29 00:00:00.000000,  2016-02-29 00:00:00.000000      ]
-[ 2016-12-31 23:59:58.000000,  2016-12-31 23:59:58.000000      ]
+% timestamp,   timestamptz # type
+% 26,  32 # length
+[ 1999-12-31 23:59:59.000000,  2000-01-01 01:59:59.000000+02:00        ]
+[ 2016-01-01 00:00:00.000000,  2016-01-01 02:00:00.000000+02:00        ]
+[ 2016-02-29 00:00:00.000000,  2016-02-29 02:00:00.000000+02:00        ]
+[ 2016-12-31 23:59:58.000000,  2017-01-01 01:59:58.000000+02:00        ]
 [ NULL,        NULL    ]
 #DROP TABLE T_timestamp;
 #CREATE TABLE T_timetz (v TIMETZ);
@@ -7453,12 +7453,12 @@ stdout of test 'convert-function-test.Bu
 #SELECT v, convert(v, timestamp) from T_timestamptz;
 % sys.t_timestamptz,   sys.L3 # table_name
 % v,   L3 # name
-% timestamptz, timestamptz # type
-% 32,  32 # length
-[ 2000-01-01 01:59:59.000000+02:00,    2000-01-01 01:59:59.000000+02:00        
]
-[ 2016-01-01 02:00:00.000000+02:00,    2016-01-01 02:00:00.000000+02:00        
]
-[ 2016-02-29 02:00:00.000000+02:00,    2016-02-29 02:00:00.000000+02:00        
]
-[ 2017-01-01 01:59:58.000000+02:00,    2017-01-01 01:59:58.000000+02:00        
]
+% timestamptz, timestamp # type
+% 32,  26 # length
+[ 2000-01-01 01:59:59.000000+02:00,    1999-12-31 23:59:59.000000      ]
+[ 2016-01-01 02:00:00.000000+02:00,    2016-01-01 00:00:00.000000      ]
+[ 2016-02-29 02:00:00.000000+02:00,    2016-02-29 00:00:00.000000      ]
+[ 2017-01-01 01:59:58.000000+02:00,    2016-12-31 23:59:58.000000      ]
 [ NULL,        NULL    ]
 #SELECT v, convert(v, timetz) from T_timestamptz;
 % sys.t_timestamptz,   sys.L3 # table_name
@@ -7533,12 +7533,12 @@ stdout of test 'convert-function-test.Bu
 #SELECT v, cast(v as timestamp) from T_timestamptz;
 % sys.t_timestamptz,   sys.L3 # table_name
 % v,   L3 # name
-% timestamptz, timestamptz # type
-% 32,  32 # length
-[ 2000-01-01 01:59:59.000000+02:00,    2000-01-01 01:59:59.000000+02:00        
]
-[ 2016-01-01 02:00:00.000000+02:00,    2016-01-01 02:00:00.000000+02:00        
]
-[ 2016-02-29 02:00:00.000000+02:00,    2016-02-29 02:00:00.000000+02:00        
]
-[ 2017-01-01 01:59:58.000000+02:00,    2017-01-01 01:59:58.000000+02:00        
]
+% timestamptz, timestamp # type
+% 32,  26 # length
+[ 2000-01-01 01:59:59.000000+02:00,    1999-12-31 23:59:59.000000      ]
+[ 2016-01-01 02:00:00.000000+02:00,    2016-01-01 00:00:00.000000      ]
+[ 2016-02-29 02:00:00.000000+02:00,    2016-02-29 00:00:00.000000      ]
+[ 2017-01-01 01:59:58.000000+02:00,    2016-12-31 23:59:58.000000      ]
 [ NULL,        NULL    ]
 #SELECT v, cast(v as timetz) from T_timestamptz;
 % sys.t_timestamptz,   sys.L3 # table_name
_______________________________________________
checkin-list mailing list
[email protected]
https://www.monetdb.org/mailman/listinfo/checkin-list

Reply via email to