Changeset: de5daedf6513 for MonetDB
URL: https://dev.monetdb.org/hg/MonetDB/rev/de5daedf6513
Modified Files:
        clients/odbc/tests/ODBCmetadata.c
        sql/backends/monet5/sql_upgrades.c
        sql/scripts/10_sys_schema_extension.sql
        sql/test/BugTracker-2025/Tests/7625_missing_temporary_view_types.test
Branch: Mar2025
Log Message:

Remove table_type GLOBAL TEMPORARY VIEW.
Updated tests.


diffs (126 lines):

diff --git a/clients/odbc/tests/ODBCmetadata.c 
b/clients/odbc/tests/ODBCmetadata.c
--- a/clients/odbc/tests/ODBCmetadata.c
+++ b/clients/odbc/tests/ODBCmetadata.c
@@ -503,11 +503,12 @@ main(int argc, char **argv)
                        (SQLCHAR*)SQL_ALL_TABLE_TYPES, SQL_NTS);
        compareResult(stmt, ret, "SQLTables (SQL_ALL_TABLE_TYPES)",
                "Resultset with 5 columns\n"
-               "Resultset with 10 rows\n"
+               "Resultset with 11 rows\n"
                "TABLE_CAT      TABLE_SCHEM     TABLE_NAME      TABLE_TYPE      
REMARKS\n"
                "WVARCHAR(1)    WVARCHAR(1)     WVARCHAR(1)     WVARCHAR(25)    
WVARCHAR(1)\n"
                "NULL   NULL    NULL    GLOBAL TEMPORARY TABLE  NULL\n"
                "NULL   NULL    NULL    LOCAL TEMPORARY TABLE   NULL\n"
+               "NULL   NULL    NULL    LOCAL TEMPORARY VIEW    NULL\n"
                "NULL   NULL    NULL    MERGE TABLE     NULL\n"
                "NULL   NULL    NULL    REMOTE TABLE    NULL\n"
                "NULL   NULL    NULL    REPLICA TABLE   NULL\n"
@@ -688,8 +689,8 @@ main(int argc, char **argv)
                "Resultset with 2 rows\n"
                "TABLE_CAT      TABLE_SCHEM     TABLE_NAME      NON_UNIQUE      
INDEX_QUALIFIER INDEX_NAME      TYPE    ORDINAL_POSITION        COLUMN_NAME     
ASC_OR_DESC     CARDINALITY     PAGES   FILTER_CONDITION\n"
                "WVARCHAR(1)    WVARCHAR(1024)  WVARCHAR(1024)  SMALLINT        
WVARCHAR(1)     WVARCHAR(1024)  SMALLINT        SMALLINT        WVARCHAR(1024)  
WCHAR(1)        INTEGER INTEGER WVARCHAR(1)\n"
-               "NULL   sys     table_types     0       NULL    
table_types_table_type_id_pkey  2       1       table_type_id   NULL    10      
NULL    NULL\n"
-               "NULL   sys     table_types     0       NULL    
table_types_table_type_name_unique      2       1       table_type_name NULL    
10      NULL    NULL\n");
+               "NULL   sys     table_types     0       NULL    
table_types_table_type_id_pkey  2       1       table_type_id   NULL    11      
NULL    NULL\n"
+               "NULL   sys     table_types     0       NULL    
table_types_table_type_name_unique      2       1       table_type_name NULL    
11      NULL    NULL\n");
 
        ret = SQLStatistics(stmt, (SQLCHAR*)"", SQL_NTS,
                        (SQLCHAR*)"sys", SQL_NTS, (SQLCHAR*)"table_types", 
SQL_NTS,
@@ -699,8 +700,8 @@ main(int argc, char **argv)
                "Resultset with 2 rows\n"
                "TABLE_CAT      TABLE_SCHEM     TABLE_NAME      NON_UNIQUE      
INDEX_QUALIFIER INDEX_NAME      TYPE    ORDINAL_POSITION        COLUMN_NAME     
ASC_OR_DESC     CARDINALITY     PAGES   FILTER_CONDITION\n"
                "WVARCHAR(1)    WVARCHAR(1024)  WVARCHAR(1024)  SMALLINT        
WVARCHAR(1)     WVARCHAR(1024)  SMALLINT        SMALLINT        WVARCHAR(1024)  
WCHAR(1)        INTEGER INTEGER WVARCHAR(1)\n"
-               "NULL   sys     table_types     0       NULL    
table_types_table_type_id_pkey  2       1       table_type_id   NULL    10      
NULL    NULL\n"
-               "NULL   sys     table_types     0       NULL    
table_types_table_type_name_unique      2       1       table_type_name NULL    
10      NULL    NULL\n");
+               "NULL   sys     table_types     0       NULL    
table_types_table_type_id_pkey  2       1       table_type_id   NULL    11      
NULL    NULL\n"
+               "NULL   sys     table_types     0       NULL    
table_types_table_type_name_unique      2       1       table_type_name NULL    
11      NULL    NULL\n");
 
        ret = SQLTablePrivileges(stmt, (SQLCHAR*)"", SQL_NTS,
                        (SQLCHAR*)"sys", SQL_NTS, (SQLCHAR*)"table_types", 
SQL_NTS);
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
@@ -4767,15 +4767,14 @@ sql_update_mar2025_sp1(Client c, mvc *sq
                throw(SQL, __func__, SQLSTATE(HY013) MAL_MALLOC_FAIL);
 
        /* 10_sys_schema_extension.sql */
-       /* if the table types: GLOBAL TEMPORARY VIEW, LOCAL TEMPORARY VIEW are
+       /* if the table type LOCAL TEMPORARY VIEW is
         * not in the list of table_types, upgrade */
-       pos = snprintf(buf, bufsize, "select table_type_name from 
sys.table_types where table_type_name IN ('GLOBAL TEMPORARY VIEW','LOCAL 
TEMPORARY VIEW');\n");
+       pos = snprintf(buf, bufsize, "select table_type_name from 
sys.table_types where table_type_name = 'LOCAL TEMPORARY VIEW';\n");
        assert(pos < bufsize);
        err = SQLstatementIntern(c, buf, "update", true, false, &output);
        if (err == MAL_SUCCEED && (b = BBPquickdesc(output->cols[0].b)) && 
BATcount(b) == 0) {
                pos = snprintf(buf, bufsize,
                                "ALTER TABLE sys.table_types SET READ WRITE;\n"
-                               "INSERT INTO sys.table_types VALUES (21, 
'GLOBAL TEMPORARY VIEW');\n"
                                "INSERT INTO sys.table_types VALUES (31, 'LOCAL 
TEMPORARY VIEW');\n");
                assert(pos < bufsize);
                printf("Running database upgrade commands:\n%s\n", buf);
diff --git a/sql/scripts/10_sys_schema_extension.sql 
b/sql/scripts/10_sys_schema_extension.sql
--- a/sql/scripts/10_sys_schema_extension.sql
+++ b/sql/scripts/10_sys_schema_extension.sql
@@ -345,7 +345,6 @@ INSERT INTO sys.table_types (table_type_
 -- sys._tables.type value depending on values of temporary and
 -- commit_action).
   (20, 'GLOBAL TEMPORARY TABLE'),
-  (21, 'GLOBAL TEMPORARY VIEW'),
   (30, 'LOCAL TEMPORARY TABLE'),
   (31, 'LOCAL TEMPORARY VIEW');
 
diff --git 
a/sql/test/BugTracker-2025/Tests/7625_missing_temporary_view_types.test 
b/sql/test/BugTracker-2025/Tests/7625_missing_temporary_view_types.test
--- a/sql/test/BugTracker-2025/Tests/7625_missing_temporary_view_types.test
+++ b/sql/test/BugTracker-2025/Tests/7625_missing_temporary_view_types.test
@@ -23,8 +23,6 @@ 11
 SYSTEM VIEW
 20
 GLOBAL TEMPORARY TABLE
-21
-GLOBAL TEMPORARY VIEW
 30
 LOCAL TEMPORARY TABLE
 31
@@ -104,7 +102,7 @@ 1
 
 -- lists 3 rows, gtv has type = 1, temporary = 0 !! this is wrong !!
 -- The type should have been 21 (so commit_action set to 1) and temporary set 
to 1
--- Currently a GLOBAL TEMPORARY VIEW  is not distinguisable from a normal user 
VIEW
+-- Currently a GLOBAL TEMPORARY VIEW  is not distinguisable from a normal user 
VIEW and thus treated as equal
 
 
 --DROP VIEW ltv
@@ -117,11 +115,11 @@ select * from ltv order by schema_id, na
 gtv
 2000
 create global temporary view gtv as select name, schema_id, query, type, 
system, commit_action, access, temporary from sys.tables where not system@;
-21
+1
 0
 0
 0
-1
+0
 v
 2000
 create view v as select name, schema_id, query, type, system, commit_action, 
access, temporary from sys.tables where not system@;
@@ -153,8 +151,8 @@ select table_schema, table_name, table_t
 ----
 sys
 gtv
-GLOBAL TEMPORARY VIEW
-21
+VIEW
+1
 1
 sys
 v
@@ -179,7 +177,7 @@ select table_schema, table_name, view_de
 sys
 gtv
 create global temporary view gtv as select name, schema_id, query, type, 
system, commit_action, access, temporary from sys.tables where not system@;
-21
+1
 sys
 v
 create view v as select name, schema_id, query, type, system, commit_action, 
access, temporary from sys.tables where not system@;
_______________________________________________
checkin-list mailing list -- [email protected]
To unsubscribe send an email to [email protected]

Reply via email to