Changeset: bc282972de56 for MonetDB
URL: https://dev.monetdb.org/hg/MonetDB/rev/bc282972de56
Modified Files:
        sql/backends/monet5/sql.c
        sql/server/rel_dump.c
        sql/server/rel_schema.c
        sql/server/sql_parser.y
Branch: default
Log Message:

Merge with Aug2024 branch.


diffs (truncated from 442 to 300 lines):

diff --git a/clients/mapiclient/mhelp.c b/clients/mapiclient/mhelp.c
--- a/clients/mapiclient/mhelp.c
+++ b/clients/mapiclient/mhelp.c
@@ -61,9 +61,9 @@ SQLhelp sqlhelp1[] = {
         "See also 
https://www.monetdb.org/documentation/user-guide/sql-manual/data-definition/schema-definitions/"},
        {"ALTER SEQUENCE",
         "",
-        "ALTER SEQUENCE qname [ AS seq_int_datatype] [ RESTART [WITH intval]] 
[INCREMENT BY intval]\n"
-        "[MINVALUE intval | NO MINVALUE] [MAXVALUE intval | NO MAXVALUE] 
[CACHE intval] [[NO] CYCLE]",
-        "seq_int_datatype,intval",
+        "ALTER SEQUENCE qname [AS seq_int_datatype] [RESTART [WITH 
{bigint|subquery}] ] [INCREMENT BY bigint]\n"
+        "  [MINVALUE bigint | NO MINVALUE] [MAXVALUE bigint | NO MAXVALUE] 
[CACHE bigint] [[NO] CYCLE]",
+        "seq_int_datatype",
         "See also 
https://www.monetdb.org/documentation/user-guide/sql-manual/data-types/serial-types/"},
        {"ALTER TABLE",
         "",
@@ -226,9 +226,9 @@ SQLhelp sqlhelp1[] = {
         "See also 
https://www.monetdb.org/documentation/user-guide/sql-manual/data-definition/schema-definitions/"},
        {"CREATE SEQUENCE",
         "Define a new integer number sequence generator",
-        "CREATE SEQUENCE qname [ AS seq_int_datatype] [ START [WITH intval]] 
[INCREMENT BY intval]\n"
-        "[MINVALUE intval | NO MINVALUE] [MAXVALUE intval | NO MAXVALUE] 
[CACHE intval] [[NO] CYCLE]",
-        "seq_int_datatype,intval",
+        "CREATE SEQUENCE qname [AS seq_int_datatype] [START WITH bigint] 
[INCREMENT BY bigint]\n"
+        "  [MINVALUE bigint | NO MINVALUE] [MAXVALUE bigint | NO MAXVALUE] 
[CACHE bigint] [[NO] CYCLE]",
+        "seq_int_datatype",
         "See also 
https://www.monetdb.org/documentation/user-guide/sql-manual/data-types/serial-types/"},
        {"CREATE TABLE",
         "Create a new table",
@@ -622,9 +622,10 @@ SQLhelp sqlhelp2[] = {
         NULL},
        {"column_constraint",
         NULL,
-        "[ CONSTRAINT ident ] { NOT NULL | NULL | UNIQUE | PRIMARY KEY | CHECK 
'(' search_condition ')' |\n"
-        "    REFERENCES qname [ column_list ] [ match_options ] [ 
reference_action ] }\n",
-        "column_list,search_condition,match_options,reference_action",
+        "[ CONSTRAINT ident ] { NOT NULL | NULL | CHECK '(' search_condition 
')' |\n"
+        "    PRIMARY KEY | UNIQUE | UNIQUE NULLS [ NOT ] DISTINCT |\n"
+        "    REFERENCES qname [ column_list ] [ match_option ] [ 
reference_actions ] }",
+        "column_list,search_condition,reference_actions,match_option",
         "See also 
https://www.monetdb.org/documentation/user-guide/sql-manual/data-definition/table-elements/"},
        {"control_statement",
         NULL,
@@ -675,8 +676,9 @@ SQLhelp sqlhelp2[] = {
         NULL},
        {"generated_column",
         NULL,
-        "AUTO_INCREMENT | GENERATED { ALWAYS | BY DEFAULT } AS IDENTITY [ '(' 
[ AS seq_int_datatype] [ START [WITH start]]\n"
-        " [INCREMENT BY increment] [MINVALUE minvalue | NO MINVALUE] [MAXVALUE 
maxvalue | NO MAXVALUE] [CACHE cachevalue] [[NO] CYCLE] ')' ]",
+        "AUTO_INCREMENT | GENERATED { ALWAYS | BY DEFAULT } AS IDENTITY [ 
'('\n"
+        "  [AS seq_int_datatype] [START WITH bigint] [INCREMENT BY bigint]\n"
+        "  [MINVALUE bigint | NO MINVALUE] [MAXVALUE bigint | NO MAXVALUE] 
[CACHE bigint] [[NO] CYCLE] ')' ]",
         "seq_int_datatype",
         "See also 
https://www.monetdb.org/documentation/user-guide/sql-manual/data-types/serial-types/"},
        {"global_privileges",
@@ -733,11 +735,6 @@ SQLhelp sqlhelp2[] = {
         "INTERVAL { YEAR | MONTH | DAY | HOUR | MINUTE | SECOND 
[time_precision] | start_field TO end_field }",
         "time_precision,start_field,end_field",
         NULL},
-       {"intval",
-        "Integer value",
-        NULL,
-        NULL,
-        NULL},
        {"isolevel",
         NULL,
         "READ UNCOMMITTED | READ COMMITTED | REPEATABLE READ | SERIALIZABLE",
@@ -748,9 +745,9 @@ SQLhelp sqlhelp2[] = {
         "C | CPP | R | PYTHON | PYTHON3",
         NULL,
         NULL},
-       {"match_options",
+       {"match_option",
         NULL,
-        "MATCH { FULL | PARTIAL | SIMPLE }",
+        "MATCH [ FULL | PARTIAL | SIMPLE ]",
         NULL,
         NULL},
        {"merge_list",
@@ -868,9 +865,24 @@ SQLhelp sqlhelp2[] = {
         "ident [ '.' ident ['.' ident]]",
         NULL,
         NULL},
-       {"reference_action",
+       {"ref_action",
+        NULL,
+        "RESTRICT | CASCADE | NO ACTION | SET NULL | SET DEFAULT",
+        NULL,
+        NULL},
+       {"ref_on_delete",
+        NULL,
+        "ON DELETE ref_action",
         NULL,
-        "ON { UPDATE | DELETE } { NO ACTION | CASCADE | RESTRICT | SET NULL | 
SET DEFAULT }",
+        NULL},
+       {"ref_on_update",
+        NULL,
+        "ON UPDATE ref_action",
+        NULL,
+        NULL},
+       {"reference_actions",
+        NULL,
+        "ref_on_delete | ref_on_update | ref_on_delete ref_on_update | 
ref_on_update ref_on_delete",
         NULL,
         NULL},
        {"return_statement",
@@ -911,9 +923,9 @@ SQLhelp sqlhelp2[] = {
        {"table_constraint",
         NULL,
         "[ CONSTRAINT ident ] { CHECK '(' search_condition ')' |\n"
-        "    PRIMARY KEY column_list | UNIQUE column_list |\n"
-        "    FOREIGN KEY column_list REFERENCES qname [ column_list ] [ 
match_options ] [ reference_action ] }",
-        "column_list,search_condition,match_options,reference_action",
+        "    PRIMARY KEY column_list | UNIQUE column_list | UNIQUE NULLS [ NOT 
] DISTINCT column_list |\n"
+        "    FOREIGN KEY column_list REFERENCES qname [ column_list ] [ 
match_option ] [ reference_actions ] }",
+        "column_list,search_condition,reference_actions,match_option",
         "See also 
https://www.monetdb.org/documentation/user-guide/sql-manual/data-definition/table-elements/"},
        {"table_element",
         NULL,
@@ -958,7 +970,7 @@ SQLhelp sqlhelp2[] = {
         NULL},
        {"transactionmode",
         NULL,
-        "{ READ ONLY | READ WRITE | ISOLATION LEVEL isolevel | DIAGNOSTICS 
intval } [ , ... ]",
+        "{ READ ONLY | READ WRITE | ISOLATION LEVEL isolevel | DIAGNOSTICS 
integer } [ , ... ]",
         "isolevel",
         "Note: DIAGNOSTICS is not yet implemented"},
        {"trigger_reference",
diff --git a/clients/mapiclient/msqldump.1 b/clients/mapiclient/msqldump.1
--- a/clients/mapiclient/msqldump.1
+++ b/clients/mapiclient/msqldump.1
@@ -135,7 +135,7 @@ option are specified, the last one is us
 The
 .B \-\-outputdir
 option is not compatible with the
-\B \-\-inserts
+.B \-\-inserts
 option.
 .TP
 \fB\-\-compression=\fP\fIextension\fP (\fB\-x\fP \fIextension\fP)
diff --git a/documentation/source/manual_pages/msqldump.rst 
b/documentation/source/manual_pages/msqldump.rst
--- a/documentation/source/manual_pages/msqldump.rst
+++ b/documentation/source/manual_pages/msqldump.rst
@@ -48,7 +48,7 @@ OPTIONS
 
 **--host=**\ *hostname* (**-h** *hostname*)
    Specify the name of the host on which the server runs (default:
-   localhost).
+   **localhost**).
 
 **--port=**\ *portnr* (**-p** *portnr*)
    Specify the portnumber of the server (default: 50000).
@@ -91,8 +91,8 @@ OPTIONS
    **--compression** option is used, the CSV files will be compressed
    using the specified compression scheme. If both the **--outputdir**
    option and the **--output** option are specified, the last one is
-   used. The **--outputdir** option is not compatible with the --inserts
-   option.
+   used. The **--outputdir** option is not compatible with the
+   **--inserts** option.
 
 **--compression=**\ *extension* (**-x** *extension*\ )
    Compress the CSV files produced with the **--outputdir** option using
diff --git a/monetdb5/mal/mal.h b/monetdb5/mal/mal.h
--- a/monetdb5/mal/mal.h
+++ b/monetdb5/mal/mal.h
@@ -216,7 +216,7 @@ typedef struct MALSTK {
  * for use in profiling instructions.
  */
        struct timeval clock;           /* time this stack was created */
-       char status;                            /* srunning 'R' suspended 'S', 
quitting 'Q' */
+       char status;                            /* running 'R' suspended 'S', 
quitting 'Q' */
        int pcup;                                       /* saved pc upon a 
recursive all */
        oid tag;                                        /* unique invocation 
call tag */
        lng memory;                                     /* Actual memory claims 
for highwater mark */
diff --git a/monetdb5/modules/atoms/json.c b/monetdb5/modules/atoms/json.c
--- a/monetdb5/modules/atoms/json.c
+++ b/monetdb5/modules/atoms/json.c
@@ -1754,7 +1754,7 @@ JSONplaintext(char **r, size_t *l, size_
                                        } else if ((u & 0xFC00) == 0xD800) {
                                                /* high surrogate; must be 
followed by low surrogate */
                                                *(*r)++ = 0xF0 | (((u & 0x03C0) 
+ 0x0040) >> 8);
-                                               *(*r)++ = 0x80 | ((((u & 
0x03C0) + 0x0040) >> 2) & 0x3F);
+                                               *(*r)++ = 0x80 | ((((u & 0x3FF) 
+ 0x0040) >> 2) & 0x3F);
                                                **r = 0x80 | ((u & 0x0003) << 
4);       /* no increment */
                                                (*l) -= 2;
                                        } else if ((u & 0xFC00) == 0xDC00) {
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
@@ -5510,7 +5510,7 @@ SQLcheck(Client cntxt, MalBlkPtr mb, Mal
        str msg = NULL;
        str *r = getArgReference_str(stk, pci, 0);
        const char *sname = *getArgReference_str(stk, pci, 1);
-       const char *cname = *getArgReference_str(stk, pci, 2);
+       const char *kname = *getArgReference_str(stk, pci, 2);
 
        if ((msg = getSQLContext(cntxt, mb, &m, NULL)) != NULL)
                return msg;
@@ -5519,7 +5519,7 @@ SQLcheck(Client cntxt, MalBlkPtr mb, Mal
        (void)sname;
        sql_schema *s = mvc_bind_schema(m, sname);
        if (s) {
-               sql_key *k = mvc_bind_key(m, s, cname);
+               sql_key *k = mvc_bind_key(m, s, kname);
                if (k && k->check) {
                        int pos = 0;
                        sql_rel *rel = rel_basetable(m, k->t, k->t->base.name);
diff --git a/sql/include/sql_relation.h b/sql/include/sql_relation.h
--- a/sql/include/sql_relation.h
+++ b/sql/include/sql_relation.h
@@ -72,6 +72,7 @@ typedef struct expression {
         symmetric:1; /* compare between symmetric */
        sql_subtype     tpe;
        void *p;        /* properties for the optimizer */
+       str comment;
 } sql_exp;
 
 #define TABLE_PROD_FUNC                1
diff --git a/sql/server/rel_dump.c b/sql/server/rel_dump.c
--- a/sql/server/rel_dump.c
+++ b/sql/server/rel_dump.c
@@ -348,6 +348,12 @@ exp_print(mvc *sql, stream *fout, sql_ex
                        mnstr_printf(fout, "\"%s\".", 
dump_escape_ident(sql->ta, exp_relname(e)));
                mnstr_printf(fout, "\"%s\"", dump_escape_ident(sql->ta, 
exp_name(e)));
        }
+
+       if (e->comment) {
+               str s = ATOMformat(TYPE_str, e->comment);
+               mnstr_printf(fout,  " COMMENT %s ", s);
+               GDKfree(s);
+       }
        if (comma)
                mnstr_printf(fout, ", ");
 }
@@ -1763,6 +1769,19 @@ exp_read(mvc *sql, sql_rel *lrel, sql_re
                if (rlabel && rlabel == nlabel)
                        exp->alias.label = rlabel;
        }
+
+       skipWS(r, pos);
+
+
+       //void *ptr = readAtomString(tpe->type->localtype, r, pos);
+       if (strncmp(r+*pos, "COMMENT",  strlen("COMMENT")) == 0) {
+               (*pos)+= (int) strlen("COMMENT");
+               skipWS(r, pos);
+               str comment = readAtomString(TYPE_str, r, pos);
+               exp->comment = sa_strdup(sql->sa, comment);
+               GDKfree(comment);
+       }
+
        return exp;
 }
 
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
@@ -412,9 +412,11 @@ create_check_plan(sql_query *query, symb
        mvc *sql = query->sql;
        exp_kind ek = {type_value, card_value, FALSE};
        sql_rel *rel = rel_basetable(sql, t, t->base.name);
-       sql_exp *e = rel_logical_value_exp(query, &rel, s->data.sym, sql_sel | 
sql_no_subquery, ek);
+       sql_exp *e = rel_logical_value_exp(query, &rel, 
s->data.lval->h->data.sym, sql_sel | sql_no_subquery, ek);
+
        if (!e || !rel || !is_basetable(rel->op))
                return NULL;
+       e->comment = sa_strdup(sql->sa, s->data.lval->h->next->data.sval);
        rel->exps = rel_base_projection(sql, rel, 0);
        list *pexps = sa_list(sql->sa);
        pexps = append(pexps, e);
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
@@ -243,6 +243,8 @@ int yydebug=1;
        column_exp
        column_option
        column_options
+       check_parenthesis_open
+       check_search_condition
        comment_on_statement
        comparison_predicate
        control_statement
@@ -429,6 +431,7 @@ int yydebug=1;
        blobstring
        calc_ident
        calc_restricted_ident
+       check_parenthesis_close
        clob
        column
        forest_element_name
@@ -661,6 +664,8 @@ int yydebug=1;
 %right <sval> STRING USTRING XSTRING
 %right <sval> X_BODY
 
+%token name
+
 /* sql prefixes to avoid name clashes on various architectures */
 %token <sval>
        IDENT UIDENT aTYPE RANK MARGFUNC sqlINT OIDNUM HEXADECIMALNUM OCTALNUM 
BINARYNUM INTNUM APPROXNUM
_______________________________________________
checkin-list mailing list -- checkin-list@monetdb.org
To unsubscribe send an email to checkin-list-le...@monetdb.org

Reply via email to