Changeset: 8f99f0ff2208 for MonetDB
URL: http://dev.monetdb.org/hg/MonetDB?cmd=changeset;node=8f99f0ff2208
Modified Files:
        sql/server/sql_mvc.c
Branch: Dec2011
Log Message:

After destroying and recreating sys.columns and sys.tables, add privileges.
This fixes bug 2934.
The problem: during an catalog upgrade, sys.columns and sys.tables are
dropped and recreated (in case they changed).  The new versions of
these views were not represented in the sys.privileges table.  We now
add entries for the new views, solving the bug.


diffs (33 lines):

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
@@ -85,6 +85,14 @@ mvc_init(char *dbname, int debug, store_
                mvc_create_column_(m, t, "readonly", "boolean", 1);
                mvc_create_column_(m, t, "temporary", "smallint", 16);
 
+               if (catalog_version) {
+                       int pub = ROLE_PUBLIC;
+                       int p = PRIV_SELECT;
+                       int zero = 0;
+                       sql_table *privs = find_sql_table(s, "privileges");
+                       table_funcs.table_insert(m->session->tr, privs, 
&t->base.id, &pub, &p, &zero, &zero);
+               }
+
                t = mvc_create_view(m, s, "columns", SQL_PERSIST, "SELECT * 
FROM (SELECT p.* FROM \"sys\".\"_columns\" AS p UNION ALL SELECT t.* FROM 
\"tmp\".\"_columns\" AS t) AS columns;", 1);
                mvc_create_column_(m, t, "id", "int", 32);
                mvc_create_column_(m, t, "name", "varchar", 1024);
@@ -97,6 +105,14 @@ mvc_init(char *dbname, int debug, store_
                mvc_create_column_(m, t, "number", "int", 32);
                mvc_create_column_(m, t, "storage_type", "int", 32);
 
+               if (catalog_version) {
+                       int pub = ROLE_PUBLIC;
+                       int p = PRIV_SELECT;
+                       int zero = 0;
+                       sql_table *privs = find_sql_table(s, "privileges");
+                       table_funcs.table_insert(m->session->tr, privs, 
&t->base.id, &pub, &p, &zero, &zero);
+               }
+
                if (!catalog_version) {
                        sql_create_env(m, s);
                        sql_create_privileges(m, s);
_______________________________________________
Checkin-list mailing list
[email protected]
http://mail.monetdb.org/mailman/listinfo/checkin-list

Reply via email to