Changeset: f73038e6dc79 for MonetDB
URL: https://dev.monetdb.org/hg/MonetDB/rev/f73038e6dc79
Modified Files:
        sql/backends/monet5/dict.c
        sql/backends/monet5/for.c
        sql/backends/monet5/sql.c
Branch: Jan2022
Log Message:

Defensive lines, cannot compress system tables' columns or vacuum compressed 
columns


diffs (45 lines):

diff --git a/sql/backends/monet5/dict.c b/sql/backends/monet5/dict.c
--- a/sql/backends/monet5/dict.c
+++ b/sql/backends/monet5/dict.c
@@ -233,6 +233,8 @@ DICTcompress_col(Client cntxt, MalBlkPtr
        if (!isTable(t))
                throw(SQL, "dict.compress", SQLSTATE(42000) "%s '%s' is not 
persistent",
                          TABLE_TYPE_DESCRIPTION(t->type, t->properties), 
t->base.name);
+       if (t->system)
+               throw(SQL, "dict.compress", SQLSTATE(42000) "columns from 
system tables cannot be compressed");
        sql_column *c = find_sql_column(t, cname);
        if (!c)
                throw(SQL, "dict.compress", SQLSTATE(3F000) "column '%s.%s.%s' 
unknown", sname, tname, cname);
diff --git a/sql/backends/monet5/for.c b/sql/backends/monet5/for.c
--- a/sql/backends/monet5/for.c
+++ b/sql/backends/monet5/for.c
@@ -234,6 +234,8 @@ FORcompress_col(Client cntxt, MalBlkPtr 
        if (!isTable(t))
                throw(SQL, "for.compress", SQLSTATE(42000) "%s '%s' is not 
persistent",
                          TABLE_TYPE_DESCRIPTION(t->type, t->properties), 
t->base.name);
+       if (t->system)
+               throw(SQL, "for.compress", SQLSTATE(42000) "columns from system 
tables cannot be compressed");
        sql_column *c = find_sql_column(t, cname);
        if (!c)
                throw(SQL, "for.compress", SQLSTATE(3F000) "column '%s.%s.%s' 
unknown", sname, tname, cname);
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
@@ -4959,6 +4959,8 @@ SQLstr_column_vacuum(Client cntxt, MalBl
                          TABLE_TYPE_DESCRIPTION(t->type, t->properties), 
t->base.name);
        if ((c = mvc_bind_column(m, t, cname)) == NULL)
                throw(SQL, "sql.str_column_vacuum", SQLSTATE(42S22) "Column not 
found %s.%s",sname,tname);
+       if (c->storage_type)
+               throw(SQL, "sql.str_column_vacuum", SQLSTATE(42000) "Cannot 
vaccum compressed column");
 
        return do_str_column_vacuum(tr, c, sname, tname, cname);
 }
@@ -5076,6 +5078,8 @@ SQLstr_column_auto_vacuum(Client cntxt, 
                          TABLE_TYPE_DESCRIPTION(t->type, t->properties), 
t->base.name);
        if ((c = mvc_bind_column(m, t, cname)) == NULL)
                throw(SQL, "sql.str_column_auto_vacuum", SQLSTATE(42S22) 
"Column not found %s.%s",sname,tname);
+       if (c->storage_type)
+               throw(SQL, "sql.str_column_auto_vacuum", SQLSTATE(42000) 
"Cannot vaccum compressed column");
 
        if (!(sname_copy = GDKstrdup(sname)) || !(tname_copy = 
GDKstrdup(tname)) || !(cname_copy = GDKstrdup(cname))) {
                GDKfree(sname_copy);
_______________________________________________
checkin-list mailing list
[email protected]
https://www.monetdb.org/mailman/listinfo/checkin-list

Reply via email to