Changeset: 9da76d750a37 for MonetDB
URL: https://dev.monetdb.org/hg/MonetDB?cmd=changeset;node=9da76d750a37
Removed Files:
        sql/test/BugTracker-2009/drop_history.sql
        sql/test/BugTracker-2009/set_history_and_drop_table.SF-2607045.sql
        sql/test/BugTracker-2011/Tests/history.Bug-2909.sql
        sql/test/BugTracker-2011/Tests/history.Bug-2909.stable.err
        sql/test/BugTracker-2011/Tests/history.Bug-2909.stable.out
Modified Files:
        sql/ChangeLog.Apr2019
        sql/backends/monet5/sql_scenario.c
        sql/backends/monet5/sql_upgrades.c
        sql/scripts/51_sys_schema_extension.sql
        sql/server/sql_env.c
        sql/server/sql_mvc.c
        sql/server/sql_mvc.h
        sql/test/BugTracker-2011/Tests/All
        sql/test/emptydb-upgrade-chain-hge/Tests/upgrade.stable.out.int128
        
sql/test/emptydb-upgrade-chain-hge/Tests/upgrade.stable.out.powerpc64.int128
        sql/test/emptydb-upgrade-chain/Tests/upgrade.stable.out
        sql/test/emptydb-upgrade-chain/Tests/upgrade.stable.out.32bit
        sql/test/emptydb-upgrade-chain/Tests/upgrade.stable.out.int128
        sql/test/emptydb-upgrade-chain/Tests/upgrade.stable.out.powerpc64
        sql/test/emptydb-upgrade-chain/Tests/upgrade.stable.out.powerpc64.int128
        sql/test/emptydb-upgrade-hge/Tests/upgrade.stable.out.int128
        sql/test/emptydb-upgrade/Tests/upgrade.stable.out
        sql/test/emptydb-upgrade/Tests/upgrade.stable.out.32bit
        sql/test/emptydb-upgrade/Tests/upgrade.stable.out.int128
        sql/test/emptydb/Tests/check.stable.out
        sql/test/emptydb/Tests/check.stable.out.32bit
        sql/test/emptydb/Tests/check.stable.out.int128
        sql/test/testdb-upgrade-chain-hge/Tests/upgrade.stable.out.int128
        sql/test/testdb-upgrade-chain/Tests/upgrade.stable.out
        sql/test/testdb-upgrade-chain/Tests/upgrade.stable.out.32bit
        sql/test/testdb-upgrade-chain/Tests/upgrade.stable.out.int128
        sql/test/testdb-upgrade-hge/Tests/upgrade.stable.out.int128
        sql/test/testdb-upgrade/Tests/upgrade.stable.out
        sql/test/testdb-upgrade/Tests/upgrade.stable.out.32bit
        sql/test/testdb-upgrade/Tests/upgrade.stable.out.int128
        sql/test/testdb-upgrade/Tests/upgrade.stable.out.powerpc64.int128
Branch: Apr2019
Log Message:

Removed unused global SQL variable "history".
This fixes bug 6475.


diffs (truncated from 51190 to 300 lines):

diff --git a/sql/ChangeLog.Apr2019 b/sql/ChangeLog.Apr2019
--- a/sql/ChangeLog.Apr2019
+++ b/sql/ChangeLog.Apr2019
@@ -1,6 +1,9 @@
 # ChangeLog file for sql
 # This file is updated with Maddlog
 
+* Fri Jan 18 2019 Sjoerd Mullender <[email protected]>
+- Removed unused global SQL variable "history".
+
 * Thu Dec 20 2018 Pedro Ferreira <[email protected]>
 - Allow usage of custom expressions in GROUP BY and PARTITION BY
   clauses. The same expressions can be used in the projection phase as
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
@@ -231,7 +231,7 @@ SQLepilogue(void *ret)
        if(!stack_push_var(sql, name, &ctype) || !stack_set_var(sql, name, 
VALset(&src, ctype.type->localtype, val))) \
                failure--;
 
-#define NR_GLOBAL_VARS 10
+#define NR_GLOBAL_VARS 9
 /* NR_GLOBAL_VAR should match exactly the number of variables created
    in global_variables */
 /* initialize the global variable, ie make mvc point to these */
@@ -241,7 +241,6 @@ global_variables(mvc *sql, char *user, c
        sql_subtype ctype;
        char *typename;
        lng sec = 0;
-       bit F = FALSE;
        ValRecord src;
        str opt;
        int failure = 0;
@@ -267,10 +266,6 @@ global_variables(mvc *sql, char *user, c
        sql_find_subtype(&ctype, typename, inttype2digits(ihour, isec), 0);
        SQLglobal("current_timezone", &sec, failure);
 
-       typename = "boolean";
-       sql_find_subtype(&ctype, typename, 0, 0);
-       SQLglobal("history", &F, failure);
-
        typename = "bigint";
        sql_find_subtype(&ctype, typename, 0, 0);
        SQLglobal("last_id", &sql->last_id, failure);
diff --git a/sql/backends/monet5/sql_upgrades.c 
b/sql/backends/monet5/sql_upgrades.c
--- a/sql/backends/monet5/sql_upgrades.c
+++ b/sql/backends/monet5/sql_upgrades.c
@@ -1754,6 +1754,24 @@ sql_update_apr2019(Client c, mvc *sql)
                        "ALTER TABLE sys.keywords SET READ WRITE;\n"
                        "INSERT INTO sys.keywords VALUES ('WINDOW');\n"
                );
+       t = mvc_bind_table(sql, s, "var_values");
+       t->system = 0;  /* make it non-system else the drop view will fail */
+       pos += snprintf(buf + pos, bufsize - pos,
+                       "DROP VIEW sys.var_values;\n"
+                       "CREATE VIEW sys.var_values (var_name, value) AS\n"
+                       "SELECT 'cache' AS var_name, convert(cache, 
varchar(10)) AS value UNION ALL\n"
+                       "SELECT 'current_role', current_role UNION ALL\n"
+                       "SELECT 'current_schema', current_schema UNION ALL\n"
+                       "SELECT 'current_timezone', current_timezone UNION 
ALL\n"
+                       "SELECT 'current_user', current_user UNION ALL\n"
+                       "SELECT 'debug', debug UNION ALL\n"
+                       "SELECT 'last_id', last_id UNION ALL\n"
+                       "SELECT 'optimizer', optimizer UNION ALL\n"
+                       "SELECT 'pi', pi() UNION ALL\n"
+                       "SELECT 'rowcnt', rowcnt;\n"
+                       "UPDATE sys._tables SET system = true WHERE name = 
'var_values' AND schema_id = (SELECT id FROM sys.schemas WHERE name = 'sys');\n"
+                       "GRANT SELECT ON sys.var_values TO PUBLIC;\n");
+
        /* 99_system.sql */
        t = mvc_bind_table(sql, s, "systemfunctions");
        t->system = 0;
diff --git a/sql/scripts/51_sys_schema_extension.sql 
b/sql/scripts/51_sys_schema_extension.sql
--- a/sql/scripts/51_sys_schema_extension.sql
+++ b/sql/scripts/51_sys_schema_extension.sql
@@ -413,7 +413,6 @@ SELECT 'current_schema', current_schema 
 SELECT 'current_timezone', current_timezone UNION ALL
 SELECT 'current_user', current_user UNION ALL
 SELECT 'debug', debug UNION ALL
-SELECT 'history', history UNION ALL
 SELECT 'last_id', last_id UNION ALL
 SELECT 'optimizer', optimizer UNION ALL
 SELECT 'pi', pi() UNION ALL
diff --git a/sql/server/sql_env.c b/sql/server/sql_env.c
--- a/sql/server/sql_env.c
+++ b/sql/server/sql_env.c
@@ -79,13 +79,6 @@ sql_update_var(mvc *m, const char *name,
                assert((lng) GDK_int_min <= sgn && sgn <= (lng) GDK_int_max);
 #endif
                m->cache = (int) sgn;
-       } else if (strcmp(name, "history") == 0) {
-#ifdef HAVE_HGE
-               assert((hge) GDK_int_min <= sgn && sgn <= (hge) GDK_int_max);
-#else
-               assert((lng) GDK_int_min <= sgn && sgn <= (lng) GDK_int_max);
-#endif
-               m->history = (sgn != 0);
        } 
        return NULL;
 }
diff --git a/sql/server/sql_mvc.c b/sql/server/sql_mvc.c
--- a/sql/server/sql_mvc.c
+++ b/sql/server/sql_mvc.c
@@ -94,8 +94,6 @@ mvc_init(int debug, store_type store, in
 
        /* disable caching */
        m->caching = 0;
-       /* disable history */
-       m->history = 0;
        /* disable size header */
        m->sizeheader = 0;
 
@@ -674,7 +672,6 @@ mvc_create(int clientid, backend_stack s
        m->debug = debug;
        m->cache = DEFAULT_CACHESIZE;
        m->caching = m->cache;
-       m->history = 0;
 
        m->label = 0;
        m->remote = 0;
@@ -756,9 +753,6 @@ mvc_reset(mvc *m, bstream *rs, stream *w
                stack_set_number(m, "cache", DEFAULT_CACHESIZE);
        m->cache = DEFAULT_CACHESIZE;
        m->caching = m->cache;
-       if (m->history != 0)
-               stack_set_number(m, "history", 0);
-       m->history = 0;
 
        m->label = 0;
        m->remote = 0;
diff --git a/sql/server/sql_mvc.h b/sql/server/sql_mvc.h
--- a/sql/server/sql_mvc.h
+++ b/sql/server/sql_mvc.h
@@ -126,7 +126,6 @@ typedef struct mvc {
        int timezone;           /* milliseconds west of UTC */
        int cache;              /* some queries should not be cached ! */
        int caching;            /* cache current query ? */
-       int history;            /* queries statistics are kept  */
        int reply_size;         /* reply size */
        int sizeheader;         /* print size header in result set */
        int debug;
diff --git a/sql/test/BugTracker-2009/drop_history.sql 
b/sql/test/BugTracker-2009/drop_history.sql
deleted file mode 100644
--- a/sql/test/BugTracker-2009/drop_history.sql
+++ /dev/null
@@ -1,2 +0,0 @@
-set history = false;
-call resetHistory();
diff --git a/sql/test/BugTracker-2009/set_history_and_drop_table.SF-2607045.sql 
b/sql/test/BugTracker-2009/set_history_and_drop_table.SF-2607045.sql
deleted file mode 100644
--- a/sql/test/BugTracker-2009/set_history_and_drop_table.SF-2607045.sql
+++ /dev/null
@@ -1,3 +0,0 @@
-set history = true;
-create table t1 (id int);
-drop table t1;
diff --git a/sql/test/BugTracker-2011/Tests/All 
b/sql/test/BugTracker-2011/Tests/All
--- a/sql/test/BugTracker-2011/Tests/All
+++ b/sql/test/BugTracker-2011/Tests/All
@@ -52,7 +52,6 @@ HAVE_PYMONETDB?python-connections-Bug.29
 many-connects-cache.Bug-2904
 alter-table-set-read-only.bug-2906
 predicate.Bug-2908
-history.Bug-2909
 interrupted-initialization.Bug-2875
 case-overflow.Bug-2239
 sqltables.Bug-2921
diff --git a/sql/test/BugTracker-2011/Tests/history.Bug-2909.sql 
b/sql/test/BugTracker-2011/Tests/history.Bug-2909.sql
deleted file mode 100644
--- a/sql/test/BugTracker-2011/Tests/history.Bug-2909.sql
+++ /dev/null
@@ -1,2 +0,0 @@
-set history = true;
-select 1;
diff --git a/sql/test/BugTracker-2011/Tests/history.Bug-2909.stable.err 
b/sql/test/BugTracker-2011/Tests/history.Bug-2909.stable.err
deleted file mode 100644
--- a/sql/test/BugTracker-2011/Tests/history.Bug-2909.stable.err
+++ /dev/null
@@ -1,37 +0,0 @@
-stderr of test 'history.Bug-2909` in directory 'sql/test/BugTracker-2011` 
itself:
-
-
-# 17:31:53 >  
-# 17:31:53 >  "mserver5" "--debug=10" "--set" "gdk_nr_threads=0" "--set" 
"gdk_dbfarm=/ufs/sjoerd/Monet-stable/var/MonetDB" "--set" "mapi_open=true" 
"--set" "mapi_port=39058" "--set" "monet_prompt=" "--trace" "--forcemito" 
"--set" "mal_listing=2" "--dbname=mTests_test_BugTracker-2011" "--set" 
"mal_listing=0"
-# 17:31:53 >  
-
-# builtin opt  gdk_dbname = demo
-# builtin opt  gdk_dbfarm = /ufs/sjoerd/Monet-stable/var/monetdb5/dbfarm
-# builtin opt  gdk_debug = 0
-# builtin opt  gdk_alloc_map = no
-# builtin opt  gdk_vmtrim = yes
-# 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  gdk_dbfarm = /ufs/sjoerd/Monet-stable/var/MonetDB
-# cmdline opt  mapi_open = true
-# cmdline opt  mapi_port = 39058
-# cmdline opt  monet_prompt = 
-# cmdline opt  mal_listing = 2
-# cmdline opt  gdk_dbname = mTests_test_BugTracker-2011
-# cmdline opt  mal_listing = 0
-
-# 17:31:53 >  
-# 17:31:53 >  "mclient" "-lsql" "-ftest" "-Eutf-8" "-i" "-e" "--host=ottar" 
"--port=39058"
-# 17:31:53 >  
-
-
-# 17:31:53 >  
-# 17:31:53 >  "Done."
-# 17:31:53 >  
-
diff --git a/sql/test/BugTracker-2011/Tests/history.Bug-2909.stable.out 
b/sql/test/BugTracker-2011/Tests/history.Bug-2909.stable.out
deleted file mode 100644
--- a/sql/test/BugTracker-2011/Tests/history.Bug-2909.stable.out
+++ /dev/null
@@ -1,56 +0,0 @@
-stdout of test 'history.Bug-2909` in directory 'sql/test/BugTracker-2011` 
itself:
-
-
-# 17:31:53 >  
-# 17:31:53 >  "mserver5" "--debug=10" "--set" "gdk_nr_threads=0" "--set" 
"gdk_dbfarm=/ufs/sjoerd/Monet-stable/var/MonetDB" "--set" "mapi_open=true" 
"--set" "mapi_port=39058" "--set" "monet_prompt=" "--trace" "--forcemito" 
"--set" "mal_listing=2" "--dbname=mTests_test_BugTracker-2011" "--set" 
"mal_listing=0"
-# 17:31:53 >  
-
-# MonetDB 5 server v11.5.6
-# This is an unreleased version
-# Serving database 'mTests_test_BugTracker-2011', using 4 threads
-# Compiled for x86_64-unknown-linux-gnu/64bit with 64bit OIDs dynamically 
linked
-# Found 7.749 GiB available main-memory.
-# Copyright (c) 1993-July 2008 CWI.
-# Copyright (c) August 2008-2015 MonetDB B.V., all rights reserved
-# Visit http://www.monetdb.org/ for further information
-# Listening for connection requests on mapi:monetdb://ottar.ins.cwi.nl:39058/
-# MonetDB/GIS module loaded
-# MonetDB/SQL module loaded
-
-Ready.
-# SQL catalog created, loading sql scripts once
-# loading sql script: 10_math.sql
-# loading sql script: 11_times.sql
-# loading sql script: 12_url.sql
-# loading sql script: 13_date.sql
-# loading sql script: 14_inet.sql
-# loading sql script: 15_history.sql
-# loading sql script: 16_tracelog.sql
-# loading sql script: 17_compress.sql
-# loading sql script: 18_dictionary.sql
-# loading sql script: 19_cluster.sql
-# loading sql script: 20_vacuum.sql
-# loading sql script: 21_dependency_functions.sql
-# loading sql script: 22_clients.sql
-# loading sql script: 23_skyserver.sql
-# loading sql script: 24_zorder.sql
-# loading sql script: 25_debug.sql
-# loading sql script: 40_geom.sql
-# loading sql script: 80_udf.sql
-# loading sql script: 99_system.sql
-
-# 17:31:53 >  
-# 17:31:53 >  "mclient" "-lsql" "-ftest" "-Eutf-8" "-i" "-e" "--host=ottar" 
"--port=39058"
-# 17:31:53 >  
-
-#select 1;
-% .L2 # table_name
-% L2 # name
-% tinyint # type
-% 1 # length
-[ 1    ]
-
-# 17:31:53 >  
-# 17:31:53 >  "Done."
-# 17:31:53 >  
-
diff --git a/sql/test/emptydb-upgrade-chain-hge/Tests/upgrade.stable.out.int128 
b/sql/test/emptydb-upgrade-chain-hge/Tests/upgrade.stable.out.int128
--- a/sql/test/emptydb-upgrade-chain-hge/Tests/upgrade.stable.out.int128
+++ b/sql/test/emptydb-upgrade-chain-hge/Tests/upgrade.stable.out.int128
@@ -20,6 +20,20 @@ Running database upgrade commands:
 set schema sys;
 ALTER TABLE sys.keywords SET READ WRITE;
 INSERT INTO sys.keywords VALUES ('WINDOW');
+DROP VIEW sys.var_values;
+CREATE VIEW sys.var_values (var_name, value) AS
+SELECT 'cache' AS var_name, convert(cache, varchar(10)) AS value UNION ALL
+SELECT 'current_role', current_role UNION ALL
+SELECT 'current_schema', current_schema UNION ALL
+SELECT 'current_timezone', current_timezone UNION ALL
+SELECT 'current_user', current_user UNION ALL
+SELECT 'debug', debug UNION ALL
+SELECT 'last_id', last_id UNION ALL
+SELECT 'optimizer', optimizer UNION ALL
+SELECT 'pi', pi() UNION ALL
+SELECT 'rowcnt', rowcnt;
+UPDATE sys._tables SET system = true WHERE name = 'var_values' AND schema_id = 
(SELECT id FROM sys.schemas WHERE name = 'sys');
+GRANT SELECT ON sys.var_values TO PUBLIC;
 drop table sys.systemfunctions;
 create view sys.systemfunctions as select id as function_id from sys.functions 
where system;
_______________________________________________
checkin-list mailing list
[email protected]
https://www.monetdb.org/mailman/listinfo/checkin-list

Reply via email to