Changeset: 9e31b8d902d9 for MonetDB
URL: https://dev.monetdb.org/hg/MonetDB?cmd=changeset;node=9e31b8d902d9
Modified Files:
sql/server/rel_select.c
sql/server/rel_updates.c
sql/test/BugTracker-2017/Tests/cleanup_statistics.Bug-6439.stable.out
sql/test/BugTracker-2017/Tests/spurious_error.Bug-6344.stable.out
sql/test/BugTracker-2017/Tests/sqlsmith.Bug-6477.stable.err
Branch: default
Log Message:
fixed problem with insert/update with default values
fixed/corrected a hg merge problem
diffs (215 lines):
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
@@ -2585,27 +2585,7 @@ rel_logical_exp(mvc *sql, sql_rel *rel,
list_append(vals, r);
}
}
- if (!n) { /* correct types */
- sql_subtype *st;
- list *nvals = new_exp_list(sql->sa);
- node *n;
-
- if (list_length(ll) != 1)
- return sql_error(sql, 02,
SQLSTATE(42000) "IN: incorrect left hand side");
-
- l = ll->h->data;
- st = exp_subtype(l);
- for (n=vals->h; n; n = n->next) {
- if ((r = rel_check_type(sql, st,
n->data, type_equal)) == NULL)
- return NULL;
- list_append(nvals, r);
- }
- e = exp_in(sql->sa, l, nvals,
sc->token==SQL_NOT_IN?cmp_notin:cmp_in);
- rel = rel_select(sql->sa, rel, e);
- if (pexps)
- rel = rel_project(sql->sa, rel, pexps);
- return rel;
- } else { /* complex case */
+ if (n) { /* complex case */
vals = new_exp_list(sql->sa);
n = dl->h->next;
n = n->data.lval->h;
diff --git a/sql/server/rel_updates.c b/sql/server/rel_updates.c
--- a/sql/server/rel_updates.c
+++ b/sql/server/rel_updates.c
@@ -25,7 +25,10 @@ insert_value(mvc *sql, sql_column *c, sq
return exp_atom(sql->sa, atom_general(sql->sa, &c->type, NULL));
} else if (s->token == SQL_DEFAULT) {
if (c->def) {
- return rel_parse_val(sql, sa_message(sql->sa, "select
CAST(%s AS %s);", c->def, c->type.type->sqlname), sql->emode);
+ sql_exp *e = rel_parse_val(sql, sa_message(sql->sa,
"select CAST(%s AS %s);", c->def, c->type.type->sqlname), sql->emode);
+ if (!e || (e = rel_check_type(sql, &c->type, e,
type_equal)) == NULL)
+ return NULL;
+ return e;
} else {
return sql_error(sql, 02, "INSERT INTO: column '%s' has
no valid default value", c->base.name);
}
@@ -1734,7 +1737,10 @@ rel_parse_val(mvc *m, char *query, char
m->session->status = status;
strcpy(m->errstr, errstr);
} else {
+ int label = m->label;
*m = o;
+
+ m->label = label;
}
return e;
}
diff --git
a/sql/test/BugTracker-2017/Tests/cleanup_statistics.Bug-6439.stable.out
b/sql/test/BugTracker-2017/Tests/cleanup_statistics.Bug-6439.stable.out
--- a/sql/test/BugTracker-2017/Tests/cleanup_statistics.Bug-6439.stable.out
+++ b/sql/test/BugTracker-2017/Tests/cleanup_statistics.Bug-6439.stable.out
@@ -37,7 +37,7 @@ Ready.
[ 1, "one" ]
[ 2, "two" ]
#DELETE FROM sys.statistics;
-[ 207 ]
+[ 221 ]
#SELECT /* column_id, */ type, width, /* stamp, */ "sample", "count",
"unique", nils, minval, maxval, sorted, revsorted FROM sys.statistics;
% sys.statistics, sys.statistics, sys.statistics, sys.statistics,
sys.statistics, sys.statistics, sys.statistics, sys.statistics, sys.statistics,
sys.statistics # table_name
% type, width, sample, count, unique, nils, minval, maxval, sorted,
revsorted # name
diff --git a/sql/test/BugTracker-2017/Tests/spurious_error.Bug-6344.stable.out
b/sql/test/BugTracker-2017/Tests/spurious_error.Bug-6344.stable.out
--- a/sql/test/BugTracker-2017/Tests/spurious_error.Bug-6344.stable.out
+++ b/sql/test/BugTracker-2017/Tests/spurious_error.Bug-6344.stable.out
@@ -41,67 +41,67 @@ Ready.
% c0, c1, c2, c3, c4, c5, c6 # name
% varchar, int, varchar, int, int, tinyint, int #
type
% 20, 4, 20, 4, 4, 2, 4 # length
-[ "srid", 6939, "srid", 6939, 6939, 11, 6939 ]
-[ "srid", 6938, "srid", 6938, 6938, 11, 6938 ]
-[ "keyword", 7653, "keyword", 7653, 7653, 11, 7653 ]
-[ "keyword", 7652, "keyword", 7652, 7652, 11, 7652 ]
-[ "table_type_id", 7658, "table_type_id", 7658, 7658, 11,
7658 ]
-[ "table_type_name", 7661, "table_type_name", 7661, 7661, 11,
7661 ]
-[ "table_type_id", 7657, "table_type_id", 7657, 7657, 11,
7657 ]
-[ "table_type_name", 7660, "table_type_name", 7660, 7660, 11,
7660 ]
-[ "dependency_type_id", 7666, "dependency_type_id", 7666, 7666,
11, 7666 ]
-[ "dependency_type_name", 7669, "dependency_type_name", 7669, 7669,
11, 7669 ]
-[ "dependency_type_id", 7665, "dependency_type_id", 7665, 7665,
11, 7665 ]
-[ "dependency_type_name", 7668, "dependency_type_name", 7668, 7668,
11, 7668 ]
-[ "function_type_id", 7674, "function_type_id", 7674, 7674, 11,
7674 ]
-[ "function_type_name", 7677, "function_type_name", 7677, 7677,
11, 7677 ]
-[ "function_type_id", 7673, "function_type_id", 7673, 7673, 11,
7673 ]
-[ "function_type_name", 7676, "function_type_name", 7676, 7676,
11, 7676 ]
-[ "language_id", 7682, "language_id", 7682, 7682, 11, 7682
]
-[ "language_name", 7685, "language_name", 7685, 7685, 11,
7685 ]
-[ "language_id", 7681, "language_id", 7681, 7681, 11, 7681
]
-[ "language_name", 7684, "language_name", 7684, 7684, 11,
7684 ]
-[ "key_type_id", 7690, "key_type_id", 7690, 7690, 11, 7690
]
-[ "key_type_name", 7693, "key_type_name", 7693, 7693, 11,
7693 ]
-[ "key_type_id", 7689, "key_type_id", 7689, 7689, 11, 7689
]
-[ "key_type_name", 7692, "key_type_name", 7692, 7692, 11,
7692 ]
-[ "index_type_id", 7698, "index_type_id", 7698, 7698, 11,
7698 ]
-[ "index_type_name", 7701, "index_type_name", 7701, 7701, 11,
7701 ]
-[ "index_type_id", 7697, "index_type_id", 7697, 7697, 11,
7697 ]
-[ "index_type_name", 7700, "index_type_name", 7700, 7700, 11,
7700 ]
-[ "privilege_code_id", 7706, "privilege_code_id", 7706, 7706, 11,
7706 ]
-[ "privilege_code_name", 7709, "privilege_code_name", 7709, 7709,
11, 7709 ]
-[ "privilege_code_id", 7705, "privilege_code_id", 7705, 7705, 11,
7705 ]
-[ "privilege_code_name", 7708, "privilege_code_name", 7708, 7708,
11, 7708 ]
-[ "file_id", 8132, "file_id", 8132, 8132, 11, 8132 ]
-[ "file_id", 8131, "file_id", 8131, 8131, 11, 8131 ]
-[ "sn", 8143, "sn", 8143, 8143, 11, 8143 ]
-[ "file_id", 8143, "file_id", 8143, 8143, 11, 8143 ]
-[ "file_id", 8145, "file_id", 8145, 8145, 11, 8145 ]
-[ "sn", 8142, "sn", 8142, 8142, 11, 8142 ]
-[ "file_id", 8142, "file_id", 8142, 8142, 11, 8142 ]
-[ "file_id", 8144, "file_id", 8144, 8144, 11, 8144 ]
-[ "id", 8162, "id", 8162, 8162, 11, 8162 ]
-[ "file_id", 8162, "file_id", 8162, 8162, 11, 8162 ]
-[ "file_id", 8164, "file_id", 8164, 8164, 11, 8164 ]
-[ "id", 8161, "id", 8161, 8161, 11, 8161 ]
-[ "file_id", 8161, "file_id", 8161, 8161, 11, 8161 ]
-[ "file_id", 8163, "file_id", 8163, 8163, 11, 8163 ]
-[ "id", 8174, "id", 8174, 8174, 11, 8174 ]
-[ "file_id", 8174, "file_id", 8174, 8174, 11, 8174 ]
-[ "file_id", 8176, "file_id", 8176, 8176, 11, 8176 ]
-[ "id", 8173, "id", 8173, 8173, 11, 8173 ]
-[ "file_id", 8173, "file_id", 8173, 8173, 11, 8173 ]
-[ "file_id", 8175, "file_id", 8175, 8175, 11, 8175 ]
-[ "width", 8773, "width", 8773, 8773, 11, 8773 ]
-[ "p_partkey", 8880, "p_partkey", 8880, 8880, 11, 8880 ]
-[ "p_partkey", 8879, "p_partkey", 8879, 8879, 11, 8879 ]
-[ "ps_partkey", 8889, "ps_partkey", 8889, 8889, 11, 8889
]
-[ "ps_suppkey", 8889, "ps_suppkey", 8889, 8889, 11, 8889
]
-[ "ps_partkey", 8891, "ps_partkey", 8891, 8891, 11, 8891
]
-[ "ps_partkey", 8888, "ps_partkey", 8888, 8888, 11, 8888
]
-[ "ps_suppkey", 8888, "ps_suppkey", 8888, 8888, 11, 8888
]
-[ "ps_partkey", 8890, "ps_partkey", 8890, 8890, 11, 8890
]
+[ "srid", 6969, "srid", 6969, 6969, 11, 6969 ]
+[ "srid", 6968, "srid", 6968, 6968, 11, 6968 ]
+[ "keyword", 7678, "keyword", 7678, 7678, 11, 7678 ]
+[ "keyword", 7677, "keyword", 7677, 7677, 11, 7677 ]
+[ "table_type_id", 7683, "table_type_id", 7683, 7683, 11,
7683 ]
+[ "table_type_name", 7686, "table_type_name", 7686, 7686, 11,
7686 ]
+[ "table_type_id", 7682, "table_type_id", 7682, 7682, 11,
7682 ]
+[ "table_type_name", 7685, "table_type_name", 7685, 7685, 11,
7685 ]
+[ "dependency_type_id", 7691, "dependency_type_id", 7691, 7691,
11, 7691 ]
+[ "dependency_type_name", 7694, "dependency_type_name", 7694, 7694,
11, 7694 ]
+[ "dependency_type_id", 7690, "dependency_type_id", 7690, 7690,
11, 7690 ]
+[ "dependency_type_name", 7693, "dependency_type_name", 7693, 7693,
11, 7693 ]
+[ "function_type_id", 7699, "function_type_id", 7699, 7699, 11,
7699 ]
+[ "function_type_name", 7702, "function_type_name", 7702, 7702,
11, 7702 ]
+[ "function_type_id", 7698, "function_type_id", 7698, 7698, 11,
7698 ]
+[ "function_type_name", 7701, "function_type_name", 7701, 7701,
11, 7701 ]
+[ "language_id", 7707, "language_id", 7707, 7707, 11, 7707
]
+[ "language_name", 7710, "language_name", 7710, 7710, 11,
7710 ]
+[ "language_id", 7706, "language_id", 7706, 7706, 11, 7706
]
+[ "language_name", 7709, "language_name", 7709, 7709, 11,
7709 ]
+[ "key_type_id", 7715, "key_type_id", 7715, 7715, 11, 7715
]
+[ "key_type_name", 7718, "key_type_name", 7718, 7718, 11,
7718 ]
+[ "key_type_id", 7714, "key_type_id", 7714, 7714, 11, 7714
]
+[ "key_type_name", 7717, "key_type_name", 7717, 7717, 11,
7717 ]
+[ "index_type_id", 7723, "index_type_id", 7723, 7723, 11,
7723 ]
+[ "index_type_name", 7726, "index_type_name", 7726, 7726, 11,
7726 ]
+[ "index_type_id", 7722, "index_type_id", 7722, 7722, 11,
7722 ]
+[ "index_type_name", 7725, "index_type_name", 7725, 7725, 11,
7725 ]
+[ "privilege_code_id", 7731, "privilege_code_id", 7731, 7731, 11,
7731 ]
+[ "privilege_code_name", 7734, "privilege_code_name", 7734, 7734,
11, 7734 ]
+[ "privilege_code_id", 7730, "privilege_code_id", 7730, 7730, 11,
7730 ]
+[ "privilege_code_name", 7733, "privilege_code_name", 7733, 7733,
11, 7733 ]
+[ "file_id", 8157, "file_id", 8157, 8157, 11, 8157 ]
+[ "file_id", 8156, "file_id", 8156, 8156, 11, 8156 ]
+[ "sn", 8168, "sn", 8168, 8168, 11, 8168 ]
+[ "file_id", 8168, "file_id", 8168, 8168, 11, 8168 ]
+[ "file_id", 8170, "file_id", 8170, 8170, 11, 8170 ]
+[ "sn", 8167, "sn", 8167, 8167, 11, 8167 ]
+[ "file_id", 8167, "file_id", 8167, 8167, 11, 8167 ]
+[ "file_id", 8169, "file_id", 8169, 8169, 11, 8169 ]
+[ "id", 8187, "id", 8187, 8187, 11, 8187 ]
+[ "file_id", 8187, "file_id", 8187, 8187, 11, 8187 ]
+[ "file_id", 8189, "file_id", 8189, 8189, 11, 8189 ]
+[ "id", 8186, "id", 8186, 8186, 11, 8186 ]
+[ "file_id", 8186, "file_id", 8186, 8186, 11, 8186 ]
+[ "file_id", 8188, "file_id", 8188, 8188, 11, 8188 ]
+[ "id", 8199, "id", 8199, 8199, 11, 8199 ]
+[ "file_id", 8199, "file_id", 8199, 8199, 11, 8199 ]
+[ "file_id", 8201, "file_id", 8201, 8201, 11, 8201 ]
+[ "id", 8198, "id", 8198, 8198, 11, 8198 ]
+[ "file_id", 8198, "file_id", 8198, 8198, 11, 8198 ]
+[ "file_id", 8200, "file_id", 8200, 8200, 11, 8200 ]
+[ "width", 8800, "width", 8800, 8800, 11, 8800 ]
+[ "p_partkey", 8907, "p_partkey", 8907, 8907, 11, 8907 ]
+[ "p_partkey", 8906, "p_partkey", 8906, 8906, 11, 8906 ]
+[ "ps_partkey", 8916, "ps_partkey", 8916, 8916, 11, 8916
]
+[ "ps_suppkey", 8916, "ps_suppkey", 8916, 8916, 11, 8916
]
+[ "ps_partkey", 8918, "ps_partkey", 8918, 8918, 11, 8918
]
+[ "ps_partkey", 8915, "ps_partkey", 8915, 8915, 11, 8915
]
+[ "ps_suppkey", 8915, "ps_suppkey", 8915, 8915, 11, 8915
]
+[ "ps_partkey", 8917, "ps_partkey", 8917, 8917, 11, 8917
]
# 13:47:14 >
# 13:47:14 > "Done."
diff --git a/sql/test/BugTracker-2017/Tests/sqlsmith.Bug-6477.stable.err
b/sql/test/BugTracker-2017/Tests/sqlsmith.Bug-6477.stable.err
--- a/sql/test/BugTracker-2017/Tests/sqlsmith.Bug-6477.stable.err
+++ b/sql/test/BugTracker-2017/Tests/sqlsmith.Bug-6477.stable.err
@@ -49,7 +49,8 @@ QUERY = select
from
sys.args as ref_1
left join tmp.objects as ref_2
-ERROR = !cardinality violation, scalar value expected
+ERROR = !Cardinality violation, scalar value expected
+CODE = 21000
# 14:26:12 >
# 14:26:12 > "Done."
_______________________________________________
checkin-list mailing list
[email protected]
https://www.monetdb.org/mailman/listinfo/checkin-list