Changeset: 5f098c0e4ebe for MonetDB URL: https://dev.monetdb.org/hg/MonetDB/rev/5f098c0e4ebe Modified Files: sql/backends/monet5/sql.c sql/backends/monet5/wlr.c sql/server/sql_parser.y sql/test/SQLancer/Tests/sqlancer17.test Branch: Jan2022 Log Message:
At the moment, a increment column's sequence may not be on the same sequence. This is a parser issue and later we should move the generated column code out from there diffs (99 lines): diff --git a/sql/backends/monet5/sql.c b/sql/backends/monet5/sql.c --- a/sql/backends/monet5/sql.c +++ b/sql/backends/monet5/sql.c @@ -1850,7 +1850,7 @@ mvc_clear_table_wrap(Client cntxt, MalBl if (!schema || !seq_name || !(seqs = find_sql_schema(tr, schema))) continue; - assert(seqs->base.id == s->base.id); + /* TODO - At the moment the sequence may not be stored in the same schema as the table itself */ if ((seq = find_sql_sequence(tr, seqs, seq_name))) { switch (sql_trans_sequence_restart(tr, seq, seq->start)) { case -1: diff --git a/sql/backends/monet5/wlr.c b/sql/backends/monet5/wlr.c --- a/sql/backends/monet5/wlr.c +++ b/sql/backends/monet5/wlr.c @@ -1129,7 +1129,7 @@ WLRclear_table(Client cntxt, MalBlkPtr m if (!schema || !seq_name || !(seqs = find_sql_schema(tr, schema))) continue; - assert(seqs->base.id == s->base.id); + /* TODO - At the moment the sequence may not be stored in the same schema as the table itself */ if ((seq = find_sql_sequence(tr, seqs, seq_name))) { switch (sql_trans_sequence_restart(tr, seq, seq->start)) { case -1: diff --git a/sql/server/sql_parser.y b/sql/server/sql_parser.y --- a/sql/server/sql_parser.y +++ b/sql/server/sql_parser.y @@ -1761,7 +1761,7 @@ column_def: sql_find_subtype(&it, "bigint", 64, 0); else sql_find_subtype(&it, "int", 32, 0); - append_symbol(o, _symbol_create_list(SQL_TYPE, append_type(L(),&it))); + append_symbol(o, _symbol_create_list(SQL_TYPE, append_type(L(),&it))); append_list(l, o); append_int(l, 1); /* to be dropped */ @@ -1770,7 +1770,7 @@ column_def: } else { stmts = L(); m->sym = _symbol_create_list(SQL_MULSTMT, stmts); - } + } append_symbol(stmts, _symbol_create_list(SQL_CREATE_SEQ, l)); l = L(); @@ -1864,7 +1864,7 @@ generated_column: } else { stmts = L(); m->sym = _symbol_create_list(SQL_MULSTMT, stmts); - } + } append_symbol(stmts, _symbol_create_list(SQL_CREATE_SEQ, l)); } | AUTO_INCREMENT @@ -1886,7 +1886,7 @@ generated_column: append_string(seqn1, m->scanner.schema); append_list(l, append_string(seqn1, sn)); sql_find_subtype(&it, "int", 32, 0); - append_symbol(o, _symbol_create_list(SQL_TYPE, append_type(L(),&it))); + append_symbol(o, _symbol_create_list(SQL_TYPE, append_type(L(),&it))); append_list(l, o); append_int(l, 1); /* to be dropped */ if (m->scanner.schema) diff --git a/sql/test/SQLancer/Tests/sqlancer17.test b/sql/test/SQLancer/Tests/sqlancer17.test --- a/sql/test/SQLancer/Tests/sqlancer17.test +++ b/sql/test/SQLancer/Tests/sqlancer17.test @@ -508,3 +508,32 @@ SELECT 1 FROM (SELECT 1, TRUE) vx(vc0, v ON vx.vc0 <= ALL(SELECT 1) OR vx.vc2 WHERE 0.5 < ALL(SELECT 0.6 WHERE vx.vc2) ---- 1 + +statement ok +CREATE GLOBAL TEMPORARY TABLE t3(c0 bigserial) ON COMMIT PRESERVE ROWS + +statement ok rowcount 1 +INSERT INTO t3 + +query I nosort +SELECT c0 FROM t3 +---- +1 + +statement ok rowcount 1 +TRUNCATE tmp.t3 RESTART IDENTITY + +query I nosort +SELECT c0 FROM t3 +---- + +statement ok rowcount 1 +INSERT INTO t3 + +query I nosort +SELECT c0 FROM t3 +---- +1 + +statement ok +DROP TABLE t3 _______________________________________________ checkin-list mailing list checkin-list@monetdb.org https://www.monetdb.org/mailman/listinfo/checkin-list