Changeset: f9416a00a5a2 for MonetDB
URL: https://dev.monetdb.org/hg/MonetDB/rev/f9416a00a5a2
Modified Files:
        sql/server/rel_schema.c
        sql/server/sql_parser.y
Branch: userprofile
Log Message:

make schema details optional on create user syntax


diffs (133 lines):

diff --git a/sql/server/rel_schema.c b/sql/server/rel_schema.c
--- a/sql/server/rel_schema.c
+++ b/sql/server/rel_schema.c
@@ -2918,17 +2918,18 @@ rel_schemas(sql_query *query, symbol *s)
        }       break;
        case SQL_CREATE_USER: {
                dlist *l = s->data.lval;
+               dlist *schema_details = l->h->next->next->next->data.lval;
 
                ret = rel_create_user(sql->sa, l->h->data.sval, /* user name */
                                  l->h->next->data.sval,        /* password */
                                  
l->h->next->next->next->next->next->data.i_val == SQL_PW_ENCRYPTED, /* 
encrypted */
                                  l->h->next->next->data.sval,  /* fullname */
-                                 l->h->next->next->next->data.sval,    /* 
dschema */
-                                 l->h->next->next->next->next->data.sval,      
/* schema path */
-                                 
l->h->next->next->next->next->next->next->data.l_val, /* max memory */
-                                 
l->h->next->next->next->next->next->next->next->data.i_val, /* max workers */
-                                 
l->h->next->next->next->next->next->next->next->next->data.sval, /* optimizer */
-                                 
l->h->next->next->next->next->next->next->next->next->next->data.sval); /* 
default role */
+                                 schema_details->h->data.sval, /* schema 
ident*/
+                                 schema_details->h->next->data.sval,   /* 
schema path */
+                                 
l->h->next->next->next->next->next->data.l_val,       /* max memory */
+                                 
l->h->next->next->next->next->next->next->data.i_val, /* max workers */
+                                 
l->h->next->next->next->next->next->next->next->data.sval, /* optimizer */
+                                 
l->h->next->next->next->next->next->next->next->next->data.sval); /* default 
role */
        }       break;
        case SQL_DROP_USER:
                ret = rel_schema2(sql->sa, ddl_drop_user, s->data.sval, NULL, 
0);
diff --git a/sql/server/sql_parser.y b/sql/server/sql_parser.y
--- a/sql/server/sql_parser.y
+++ b/sql/server/sql_parser.y
@@ -413,7 +413,7 @@ int yydebug=1;
        string
        type_alias
        user_schema
-       user_schema_path
+       opt_schema_path
        ustring
        varchar
        window_ident_clause
@@ -423,6 +423,7 @@ int yydebug=1;
        XML_PI_target
     opt_optimizer
     opt_default_role
+    
 
 %type <l>
        argument_list
@@ -524,6 +525,7 @@ int yydebug=1;
        XML_element_content_and_option
        XML_element_content_list
        XML_value_expression_list
+    opt_schema_details_list
 
 %type <i_val>
        _transaction_mode_list
@@ -1044,7 +1046,7 @@ opt_with_grant:
  ;
 
 opt_with_admin:
-       /* emtpy */             { $$ = 0; }
+       /* emtpy */                 { $$ = 0; }
  |     WITH ADMIN OPTION       { $$ = 1; }
  ;
 
@@ -1230,7 +1232,7 @@ alter_statement:
          append_string(l, $7);
          append_int(l, $3);
          $$ = _symbol_create_list( SQL_SET_TABLE_SCHEMA, l ); }
- | ALTER USER ident opt_with_encrypted_password user_schema user_schema_path 
opt_default_role
+ | ALTER USER ident opt_with_encrypted_password user_schema opt_schema_path 
opt_default_role
        { dlist *l = L(), *p = L();
          if (!$4 && !$5 && !$6 && !$7) {
                yyerror(m, "ALTER USER: At least one property should be 
updated");
@@ -1279,7 +1281,7 @@ user_schema:
  |  /* empty */                        { $$ = NULL; }
  ;
 
-user_schema_path:
+opt_schema_path:
        SCHEMA PATH string      { $$ = $3; }
  |  /* empty */                        { $$ = NULL; }
  ;
@@ -1482,18 +1484,17 @@ role_def:
          append_string(l, $2);
          append_int(l, $3);
          $$ = _symbol_create_list( SQL_CREATE_ROLE, l ); }
- |  USER ident WITH opt_encrypted PASSWORD string sqlNAME string SCHEMA ident 
user_schema_path opt_max_memory opt_max_workers opt_optimizer opt_default_role
-       { dlist *l = L();
+ |  USER ident WITH opt_encrypted PASSWORD string sqlNAME string 
opt_schema_details_list opt_max_memory opt_max_workers opt_optimizer 
opt_default_role
+    { dlist *l = L();
          append_string(l, $2);
          append_string(l, $6);
          append_string(l, $8);
-         append_string(l, $10);
-         append_string(l, $11);
+         append_list(l, $9);
          append_int(l, $4);
-      append_lng(l, $12);
-      append_int(l, $13);
-         append_string(l, $14);
-         append_string(l, $15);
+      append_lng(l, $10);
+      append_int(l, $11);
+         append_string(l, $12);
+      append_string(l, $13);
          $$ = _symbol_create_list( SQL_CREATE_USER, l ); }
  ;
 
@@ -1513,10 +1514,22 @@ opt_optimizer:
  ;
 
 opt_default_role:
-    /* empty */         { $$ = NULL; }
+    /* empty */           { $$ = NULL; }
  |  DEFAULT ROLE ident    { $$ = $3; }
  ;
 
+opt_schema_details_list:
+    opt_schema_path     
+    { dlist *l = L();
+      append_string(l, NULL);
+      $$ = append_string(l, $1);}
+ |  SCHEMA ident opt_schema_path
+    { dlist *l = L();
+      append_string(l, $2);
+      $$ = append_string(l, $3);}
+ ;
+
+
 opt_encrypted:
     /* empty */                { $$ = SQL_PW_UNENCRYPTED; }
  |  UNENCRYPTED                { $$ = SQL_PW_UNENCRYPTED; }
_______________________________________________
checkin-list mailing list -- checkin-list@monetdb.org
To unsubscribe send an email to checkin-list-le...@monetdb.org

Reply via email to