Changeset: 0c4ff39b0ce8 for MonetDB
URL: https://dev.monetdb.org/hg/MonetDB/rev/0c4ff39b0ce8
Modified Files:
sql/backends/monet5/sql.c
sql/backends/monet5/sql_scenario.c
sql/backends/monet5/sql_user.c
testing/Mtest.py.in
Branch: resource_management
Log Message:
merge with default
diffs (truncated from 594 to 300 lines):
diff --git a/clients/mapiclient/curl-stream.h b/clients/mapiclient/curl-stream.h
--- a/clients/mapiclient/curl-stream.h
+++ b/clients/mapiclient/curl-stream.h
@@ -53,9 +53,9 @@ open_urlstream(const char *url, char *er
if ((ret = curl_easy_setopt(handle, CURLOPT_ERRORBUFFER, errbuf)) !=
CURLE_OK ||
(ret = curl_easy_setopt(handle, CURLOPT_URL, url)) != CURLE_OK ||
(ret = curl_easy_setopt(handle, CURLOPT_WRITEDATA, s)) != CURLE_OK
||
- (ret = curl_easy_setopt(handle, CURLOPT_VERBOSE, 0)) != CURLE_OK ||
- (ret = curl_easy_setopt(handle, CURLOPT_NOSIGNAL, 1)) != CURLE_OK ||
- (ret = curl_easy_setopt(handle, CURLOPT_FAILONERROR, 1)) !=
CURLE_OK ||
+ (ret = curl_easy_setopt(handle, CURLOPT_VERBOSE, (long)0)) !=
CURLE_OK ||
+ (ret = curl_easy_setopt(handle, CURLOPT_NOSIGNAL, (long)1)) !=
CURLE_OK ||
+ (ret = curl_easy_setopt(handle, CURLOPT_FAILONERROR, (long)1)) !=
CURLE_OK ||
(ret = curl_easy_setopt(handle, CURLOPT_WRITEFUNCTION,
write_callback)) != CURLE_OK ||
(ret = curl_easy_perform(handle)) != CURLE_OK) {
curl_easy_cleanup(handle);
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
@@ -137,16 +137,13 @@ sql_symbol2relation(backend *be, symbol
{
sql_rel *rel;
sql_query *query = query_create(be->mvc);
- lng Tbegin, Tend;
int value_based_opt = be->mvc->emode != m_prepare, storage_based_opt;
int profile = be->mvc->emode == m_plan;
- Tbegin = GDKusec();
rel = rel_semantic(query, sym);
- Tend = GDKusec();
-
+
+ lng t_begin = GDKusec();
storage_based_opt = value_based_opt && rel && !is_ddl(rel->op);
- Tbegin = Tend;
if (rel && !(rel->op == op_ddl && rel->card == CARD_ATOM && rel->flag
== ddl_psm && (be->mvc->emod & mod_exec) != 0)) { /* no need to optimize exec */
if (rel)
rel = sql_processrelation(be->mvc, rel, profile, 1,
value_based_opt, storage_based_opt);
@@ -155,8 +152,7 @@ sql_symbol2relation(backend *be, symbol
if (rel)
rel = rel_physical(be->mvc, rel);
}
- Tend = GDKusec();
- be->reloptimizer = Tend - Tbegin;
+ be->reloptimizer = GDKusec() - t_begin;
return rel;
}
diff --git a/sql/backends/monet5/sql_scenario.c
b/sql/backends/monet5/sql_scenario.c
--- a/sql/backends/monet5/sql_scenario.c
+++ b/sql/backends/monet5/sql_scenario.c
@@ -1419,7 +1419,6 @@ SQLparser_body(Client c, backend *be)
{
str msg = MAL_SUCCEED;
mvc *m = be->mvc;
- lng Tbegin = 0, Tend = 0;
int pstatus = m->session->status;
@@ -1428,7 +1427,7 @@ SQLparser_body(Client c, backend *be)
m->emode = m_normal;
m->emod = mod_none;
c->query = NULL;
- c->qryctx.starttime = Tbegin = Tend = GDKusec();
+ c->qryctx.starttime = GDKusec();
c->qryctx.endtime = c->querytimeout ? c->qryctx.starttime +
c->querytimeout : 0;
if ((err = sqlparse(m)) ||
@@ -1530,8 +1529,6 @@ SQLparser_body(Client c, backend *be)
be->subbackend->reset(be->subbackend);
}
- Tbegin = GDKusec();
-
int opt = 0;
if (m->emode == m_prepare && (m->emod & mod_exec)) {
/* generated the named parameters for the
placeholders */
@@ -1555,7 +1552,6 @@ SQLparser_body(Client c, backend *be)
} else
opt = ((m->emod & mod_exec) == 0); /* no need
to optimize prepare - execute */
- Tend = GDKusec();
if (err)
m->session->status = -10;
if (err == 0) {
@@ -1567,9 +1563,7 @@ SQLparser_body(Client c, backend *be)
msg = chkTypes(c->usermodule,
c->curprg->def, TRUE);
if (msg == MAL_SUCCEED && opt) {
- Tbegin = Tend;
msg = SQLoptimizeQuery(c,
c->curprg->def);
- Tend = GDKusec();
if (msg != MAL_SUCCEED) {
str other =
c->curprg->def->errors;
c->curprg->def->errors = 0;
diff --git a/sql/backends/monet5/sql_user.c b/sql/backends/monet5/sql_user.c
--- a/sql/backends/monet5/sql_user.c
+++ b/sql/backends/monet5/sql_user.c
@@ -27,6 +27,7 @@
#include "mal_authorize.h"
#include "mcrypt.h"
#include "sql_execute.h"
+#include "opt_pipes.h"
static inline sql_table*
getUsersTbl(mvc *m)
@@ -321,6 +322,11 @@ monet5_create_user(ptr _mvc, str user, s
if (!optimizer)
optimizer = default_optimizer;
+ if (!isOptimizerPipe(optimizer)) {
+ GDKfree(schema_buf);
+ throw(MAL, "sql.create_user", SQLSTATE(42000) "Optimizer pipe
%s unknown", optimizer);
+ }
+
if (!enc) {
if (!(pwd = mcrypt_BackendSum(passwd, strlen(passwd)))) {
diff --git a/sql/test/BugTracker-2024/Tests/7605_full_3_level_name_support.test
b/sql/test/BugTracker-2024/Tests/7605_full_3_level_name_support.test
--- a/sql/test/BugTracker-2024/Tests/7605_full_3_level_name_support.test
+++ b/sql/test/BugTracker-2024/Tests/7605_full_3_level_name_support.test
@@ -22,6 +22,15 @@ my
2
query TI nosort
+select mytable.name, count(*)
+from test.mytable
+group by test.mytable.name
+order by test.mytable.name
+----
+my
+2
+
+query TI nosort
select x.name, count(*)
from test.mytable as x
group by x.name
diff --git a/sql/test/BugTracker-2025/Tests/7699-create-user.test
b/sql/test/BugTracker-2025/Tests/7699-create-user.test
new file mode 100644
--- /dev/null
+++ b/sql/test/BugTracker-2025/Tests/7699-create-user.test
@@ -0,0 +1,7 @@
+statement error
+CREATE USER test WITH PASSWORD 'me' NAME 'tester' OPTIMIZER 'xyz'
+
+query TTITIITI
+SELECT * FROM sys.users WHERE name = 'tester'
+----
+
diff --git a/sql/test/BugTracker-2025/Tests/All
b/sql/test/BugTracker-2025/Tests/All
--- a/sql/test/BugTracker-2025/Tests/All
+++ b/sql/test/BugTracker-2025/Tests/All
@@ -46,6 +46,7 @@ 7695-antijoin-without-expressions
7696-antijoin-with-complex-expression
7697-exists-any-semantics
7698-get-statistics-problem
+7699-create-user
7701-alter-user-max_workers
7702-stmt_convert_cands
7703-left-join
diff --git a/sql/test/emptydb/Tests/check.SQL.py
b/sql/test/emptydb/Tests/check.SQL.py
--- a/sql/test/emptydb/Tests/check.SQL.py
+++ b/sql/test/emptydb/Tests/check.SQL.py
@@ -87,7 +87,7 @@ sys_pkeys = [
('var_values', 'var_name'),
('table_partitions', 'id'),
- ('range_partitions', 'table_id, partition_id, minimum'),
+ ('range_partitions', 'table_id'),
('value_partitions', 'table_id, partition_id, "value"'),
('queue', 'tag'),
@@ -131,7 +131,6 @@ sys_akeys = [
('table_partitions WHERE column_id IS NOT NULL', 'table_id, column_id'),
('table_partitions WHERE "expression" IS NOT NULL', 'table_id,
"expression"'),
- ('range_partitions', 'table_id, partition_id, "maximum"'),
('fkey_actions', 'action_name'),
('fkeys', 'table_id, name'),
diff --git a/sql/test/emptydb/Tests/check.stable.out
b/sql/test/emptydb/Tests/check.stable.out
--- a/sql/test/emptydb/Tests/check.stable.out
+++ b/sql/test/emptydb/Tests/check.stable.out
@@ -114,7 +114,7 @@ select 'duplicates in comments', count(*
select 'duplicates in ids', count(*), id from sys.ids group by id having
count(*) > 1;
select 'duplicates in var_values', count(*), var_name from sys.var_values
group by var_name having count(*) > 1;
select 'duplicates in table_partitions', count(*), id from
sys.table_partitions group by id having count(*) > 1;
-select 'duplicates in range_partitions', count(*), table_id, partition_id,
minimum from sys.range_partitions group by table_id, partition_id, minimum
having count(*) > 1;
+select 'duplicates in range_partitions', count(*), table_id from
sys.range_partitions group by table_id having count(*) > 1;
select 'duplicates in value_partitions', count(*), table_id, partition_id,
"value" from sys.value_partitions group by table_id, partition_id, "value"
having count(*) > 1;
select 'duplicates in queue', count(*), tag from sys.queue group by tag having
count(*) > 1;
select 'duplicates in sessions', count(*), sessionid from sys.sessions group
by sessionid having count(*) > 1;
@@ -149,7 +149,6 @@ select 'duplicates in privilege_codes',
select 'duplicates in comments', count(*), id from sys.comments group by id
having count(*) > 1;
select 'duplicates in table_partitions WHERE column_id IS NOT NULL', count(*),
table_id, column_id from sys.table_partitions WHERE column_id IS NOT NULL group
by table_id, column_id having count(*) > 1;
select 'duplicates in table_partitions WHERE expression IS NOT NULL',
count(*), table_id, "expression" from sys.table_partitions WHERE "expression"
IS NOT NULL group by table_id, "expression" having count(*) > 1;
-select 'duplicates in range_partitions', count(*), table_id, partition_id,
"maximum" from sys.range_partitions group by table_id, partition_id, "maximum"
having count(*) > 1;
select 'duplicates in fkey_actions', count(*), action_name from
sys.fkey_actions group by action_name having count(*) > 1;
select 'duplicates in fkeys', count(*), table_id, name from sys.fkeys group by
table_id, name having count(*) > 1;
select 'missing reference in schemas authorization', authorization, * from
sys.schemas where (authorization) not in (select id from sys.auths);
@@ -5782,10 +5781,10 @@ select 'null in fkeys.delete_action', de
% %2, %1, id # name
% varchar, bigint, int # type
% 0, 1, 1 # length
-% .%2, sys.%1, sys.range_partitions, sys.range_partitions,
sys.range_partitions # table_name
-% %2, %1, table_id, partition_id, minimum # name
-% varchar, bigint, int, int, varchar # type
-% 0, 1, 1, 1, 0 # length
+% .%2, sys.%1, sys.range_partitions # table_name
+% %2, %1, table_id # name
+% varchar, bigint, int # type
+% 0, 1, 1 # length
% .%2, sys.%1, sys.value_partitions, sys.value_partitions,
sys.value_partitions # table_name
% %2, %1, table_id, partition_id, value # name
% varchar, bigint, int, int, varchar # type
@@ -5922,10 +5921,6 @@ select 'null in fkeys.delete_action', de
% %2, %1, table_id, expression # name
% varchar, bigint, int, varchar # type
% 0, 1, 1, 0 # length
-% .%2, sys.%1, sys.range_partitions, sys.range_partitions,
sys.range_partitions # table_name
-% %2, %1, table_id, partition_id, maximum # name
-% varchar, bigint, int, int, varchar # type
-% 0, 1, 1, 1, 0 # length
% .%2, sys.%1, sys.fkey_actions # table_name
% %2, %1, action_name # name
% varchar, bigint, varchar # type
diff --git a/sql/test/emptydb/Tests/check.stable.out.32bit
b/sql/test/emptydb/Tests/check.stable.out.32bit
--- a/sql/test/emptydb/Tests/check.stable.out.32bit
+++ b/sql/test/emptydb/Tests/check.stable.out.32bit
@@ -114,7 +114,7 @@ select 'duplicates in comments', count(*
select 'duplicates in ids', count(*), id from sys.ids group by id having
count(*) > 1;
select 'duplicates in var_values', count(*), var_name from sys.var_values
group by var_name having count(*) > 1;
select 'duplicates in table_partitions', count(*), id from
sys.table_partitions group by id having count(*) > 1;
-select 'duplicates in range_partitions', count(*), table_id, partition_id,
minimum from sys.range_partitions group by table_id, partition_id, minimum
having count(*) > 1;
+select 'duplicates in range_partitions', count(*), table_id from
sys.range_partitions group by table_id having count(*) > 1;
select 'duplicates in value_partitions', count(*), table_id, partition_id,
"value" from sys.value_partitions group by table_id, partition_id, "value"
having count(*) > 1;
select 'duplicates in queue', count(*), tag from sys.queue group by tag having
count(*) > 1;
select 'duplicates in sessions', count(*), sessionid from sys.sessions group
by sessionid having count(*) > 1;
@@ -149,7 +149,6 @@ select 'duplicates in privilege_codes',
select 'duplicates in comments', count(*), id from sys.comments group by id
having count(*) > 1;
select 'duplicates in table_partitions WHERE column_id IS NOT NULL', count(*),
table_id, column_id from sys.table_partitions WHERE column_id IS NOT NULL group
by table_id, column_id having count(*) > 1;
select 'duplicates in table_partitions WHERE expression IS NOT NULL',
count(*), table_id, "expression" from sys.table_partitions WHERE "expression"
IS NOT NULL group by table_id, "expression" having count(*) > 1;
-select 'duplicates in range_partitions', count(*), table_id, partition_id,
"maximum" from sys.range_partitions group by table_id, partition_id, "maximum"
having count(*) > 1;
select 'duplicates in fkey_actions', count(*), action_name from
sys.fkey_actions group by action_name having count(*) > 1;
select 'duplicates in fkeys', count(*), table_id, name from sys.fkeys group by
table_id, name having count(*) > 1;
select 'missing reference in schemas authorization', authorization, * from
sys.schemas where (authorization) not in (select id from sys.auths);
@@ -5732,10 +5731,10 @@ select 'null in fkeys.delete_action', de
% %2, %1, id # name
% varchar, bigint, int # type
% 0, 1, 1 # length
-% .%2, sys.%1, sys.range_partitions, sys.range_partitions,
sys.range_partitions # table_name
-% %2, %1, table_id, partition_id, minimum # name
-% varchar, bigint, int, int, varchar # type
-% 0, 1, 1, 1, 0 # length
+% .%2, sys.%1, sys.range_partitions # table_name
+% %2, %1, table_id # name
+% varchar, bigint, int # type
+% 0, 1, 1 # length
% .%2, sys.%1, sys.value_partitions, sys.value_partitions,
sys.value_partitions # table_name
% %2, %1, table_id, partition_id, value # name
% varchar, bigint, int, int, varchar # type
@@ -5872,10 +5871,6 @@ select 'null in fkeys.delete_action', de
% %2, %1, table_id, expression # name
% varchar, bigint, int, varchar # type
% 0, 1, 1, 0 # length
-% .%2, sys.%1, sys.range_partitions, sys.range_partitions,
sys.range_partitions # table_name
-% %2, %1, table_id, partition_id, maximum # name
-% varchar, bigint, int, int, varchar # type
-% 0, 1, 1, 1, 0 # length
% .%2, sys.%1, sys.fkey_actions # table_name
% %2, %1, action_name # name
% varchar, bigint, varchar # type
diff --git a/sql/test/emptydb/Tests/check.stable.out.int128
b/sql/test/emptydb/Tests/check.stable.out.int128
--- a/sql/test/emptydb/Tests/check.stable.out.int128
+++ b/sql/test/emptydb/Tests/check.stable.out.int128
@@ -114,7 +114,7 @@ select 'duplicates in comments', count(*
select 'duplicates in ids', count(*), id from sys.ids group by id having
count(*) > 1;
select 'duplicates in var_values', count(*), var_name from sys.var_values
group by var_name having count(*) > 1;
select 'duplicates in table_partitions', count(*), id from
sys.table_partitions group by id having count(*) > 1;
-select 'duplicates in range_partitions', count(*), table_id, partition_id,
minimum from sys.range_partitions group by table_id, partition_id, minimum
having count(*) > 1;
+select 'duplicates in range_partitions', count(*), table_id from
sys.range_partitions group by table_id having count(*) > 1;
select 'duplicates in value_partitions', count(*), table_id, partition_id,
"value" from sys.value_partitions group by table_id, partition_id, "value"
having count(*) > 1;
select 'duplicates in queue', count(*), tag from sys.queue group by tag having
count(*) > 1;
select 'duplicates in sessions', count(*), sessionid from sys.sessions group
by sessionid having count(*) > 1;
@@ -149,7 +149,6 @@ select 'duplicates in privilege_codes',
select 'duplicates in comments', count(*), id from sys.comments group by id
having count(*) > 1;
select 'duplicates in table_partitions WHERE column_id IS NOT NULL', count(*),
table_id, column_id from sys.table_partitions WHERE column_id IS NOT NULL group
by table_id, column_id having count(*) > 1;
select 'duplicates in table_partitions WHERE expression IS NOT NULL',
count(*), table_id, "expression" from sys.table_partitions WHERE "expression"
IS NOT NULL group by table_id, "expression" having count(*) > 1;
-select 'duplicates in range_partitions', count(*), table_id, partition_id,
"maximum" from sys.range_partitions group by table_id, partition_id, "maximum"
having count(*) > 1;
select 'duplicates in fkey_actions', count(*), action_name from
sys.fkey_actions group by action_name having count(*) > 1;
select 'duplicates in fkeys', count(*), table_id, name from sys.fkeys group by
table_id, name having count(*) > 1;
select 'missing reference in schemas authorization', authorization, * from
sys.schemas where (authorization) not in (select id from sys.auths);
@@ -5925,10 +5924,10 @@ select 'null in fkeys.delete_action', de
% %2, %1, id # name
% varchar, bigint, int # type
% 0, 1, 1 # length
-% .%2, sys.%1, sys.range_partitions, sys.range_partitions,
sys.range_partitions # table_name
-% %2, %1, table_id, partition_id, minimum # name
-% varchar, bigint, int, int, varchar # type
-% 0, 1, 1, 1, 0 # length
_______________________________________________
checkin-list mailing list -- [email protected]
To unsubscribe send an email to [email protected]