Changeset: 51b88c286873 for MonetDB
URL: https://dev.monetdb.org/hg/MonetDB/rev/51b88c286873
Modified Files:
sql/server/sql_parser.y
Branch: reducedstack
Log Message:
Merge with default branch.
diffs (truncated from 1794 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
@@ -103,9 +103,10 @@ SQLhelp sqlhelp1[] = {
"See also
https://www.monetdb.org/documentation/user-guide/sql-programming/flow-of-control/"},
{"COMMENT",
"Add, update or remove a comment or description for a database object",
- "COMMENT ON { SCHEMA | TABLE | VIEW | COLUMN | INDEX | SEQUENCE |
function_type }\n"
- " qname IS { 'my description text' | NULL | '' }",
- "function_type,qname",
+ "COMMENT ON { SCHEMA | TABLE | VIEW | INDEX | SEQUENCE | function_type
}\n"
+ " qname IS { 'my description text' | NULL | '' }\n"
+ "COMMENT ON COLUMN q3name IS { 'my description text' | NULL | '' }",
+ "function_type,qname,q3name",
NULL},
{"COMMIT",
"Commit the current transaction",
@@ -258,8 +259,10 @@ SQLhelp sqlhelp1[] = {
"See also
https://www.monetdb.org/documentation/user-guide/sql-manual/data-definition/privileges/"},
{"CREATE VIEW",
"Create a new view",
- "CREATE [ OR REPLACE ] VIEW qname [ column_list ] AS {
query_expression | '(' query_expression ')' }\n"
- "[ WITH CHECK OPTION ]",
+ "CREATE [ OR REPLACE ] VIEW qname [ column_list ]\n"
+ " AS { query_expression | '(' query_expression ')' } [ WITH CHECK
OPTION ]\n"
+ "CREATE [ OR REPLACE ] [ LOCAL ] { TEMPORARY | TEMP } VIEW qname [
column_list ]\n"
+ " AS { query_expression | '(' query_expression ')' }",
"qname,column_list,query_expression",
"See also
https://www.monetdb.org/documentation/user-guide/sql-manual/data-definition/view-definition/"},
{"CREATE WINDOW",
@@ -862,7 +865,12 @@ SQLhelp sqlhelp2[] = {
NULL},
{"qname",
NULL,
- "ident [ '.' ident ['.' ident]]",
+ "ident [ '.' ident ]",
+ NULL,
+ NULL},
+ {"q3name",
+ NULL,
+ "ident [ '.' ident ['.' ident] ]",
NULL,
NULL},
{"ref_action",
diff --git a/ctest/tools/monetdbe/cmocka_test.c
b/ctest/tools/monetdbe/cmocka_test.c
--- a/ctest/tools/monetdbe/cmocka_test.c
+++ b/ctest/tools/monetdbe/cmocka_test.c
@@ -51,12 +51,12 @@ static void populate_table_test(void **s
char* err;
err = monetdbe_query(mdbe,
- "INSERT INTO test VALUES "
- "(4, 40, 400, 'aaa', x'aaaaaa', '2020-06-17',
'12:00:00', '2020-06-17 12:00:00'),"
- "(6, 60, 600, 'ccc', x'cccccc', '2022-06-17',
'14:00:00', '2022-06-17 14:00:00'),"
- "(5, 50, 500, 'bbb', x'bbbbbb', '2021-06-17',
'13:00:00', '2021-06-17 13:00:00'),"
- "(NULL, NULL, NULL, NULL, NULL, NULL, NULL, NULL)",
- NULL, NULL);
+ "INSERT INTO test VALUES "
+ "(4, 40, 400, 'aaa',
x'aaaaaa', '2020-06-17', '12:00:00', '2020-06-17 12:00:00'),"
+ "(6, 60, 600, 'ccc',
x'cccccc', '2022-06-17', '14:00:00', '2022-06-17 14:00:00'),"
+ "(5, 50, 500, 'bbb',
x'bbbbbb', '2021-06-17', '13:00:00', '2021-06-17 13:00:00'),"
+ "(NULL, NULL, NULL, NULL,
NULL, NULL, NULL, NULL)",
+ NULL, NULL);
assert_null(err);
}
@@ -122,9 +122,9 @@ static void query_table_test3(void **sta
assert_int_equal((int) result->ncols, 3);
/* TODO: Figure out what is expected here.
- assert_true(CHECK_COLUMN(result, 0, BIGGEST_INTEGER_TPE, {{15}}));
- assert_true(CHECK_COLUMN(result, 1, BIGGEST_INTEGER_TPE, {{150}}));
- assert_true(CHECK_COLUMN(result, 2, BIGGEST_INTEGER_TPE, {1500}));
+ assert_true(CHECK_COLUMN(result, 0, BIGGEST_INTEGER_TPE, {{15}}));
+ assert_true(CHECK_COLUMN(result, 1, BIGGEST_INTEGER_TPE, {{150}}));
+ assert_true(CHECK_COLUMN(result, 2, BIGGEST_INTEGER_TPE, {1500}));
*/
err = monetdbe_cleanup_result(mdbe, result);
diff --git a/ctest/tools/monetdbe/example1.c b/ctest/tools/monetdbe/example1.c
--- a/ctest/tools/monetdbe/example1.c
+++ b/ctest/tools/monetdbe/example1.c
@@ -15,7 +15,7 @@
#include <stdio.h>
#include <inttypes.h>
-#define error(msg) {fprintf(stderr, "Failure: %s\n", msg); return -1;}
+#define error(msg) do{fprintf(stderr, "Failure: %s\n", msg); return
-1;}while(0)
int
main(void)
@@ -26,42 +26,42 @@ main(void)
// second argument is a string for the db directory or NULL for
in-memory mode
if (monetdbe_open(&mdbe, NULL, NULL))
- error("Failed to open database")
+ error("Failed to open database");
if ((err = monetdbe_query(mdbe, "CREATE TABLE test (x integer, y
string)", NULL, NULL)) != NULL)
- error(err)
+ error(err);
if ((err = monetdbe_query(mdbe, "INSERT INTO test VALUES (42, 'Hello'),
(NULL, 'World')", NULL, NULL)) != NULL)
- error(err)
+ error(err);
if ((err = monetdbe_query(mdbe, "SELECT x, y FROM test; ", &result,
NULL)) != NULL)
- error(err)
+ error(err);
fprintf(stdout, "Query result with %zu cols and %"PRId64" rows\n",
result->ncols, result->nrows);
for (int64_t r = 0; r < result->nrows; r++) {
for (size_t c = 0; c < result->ncols; c++) {
monetdbe_column* rcol;
if ((err = monetdbe_result_fetch(result, &rcol, c)) !=
NULL)
- error(err)
+ error(err);
switch (rcol->type) {
- case monetdbe_int32_t: {
- monetdbe_column_int32_t * col =
(monetdbe_column_int32_t *) rcol;
- if (col->data[r] == col->null_value) {
- printf("NULL");
- } else {
- printf("%d", col->data[r]);
- }
- break;
+ case monetdbe_int32_t: {
+ monetdbe_column_int32_t * col =
(monetdbe_column_int32_t *) rcol;
+ if (col->data[r] == col->null_value) {
+ printf("NULL");
+ } else {
+ printf("%d", col->data[r]);
}
- case monetdbe_str: {
- monetdbe_column_str * col =
(monetdbe_column_str *) rcol;
- if (col->is_null(col->data+r)) {
- printf("NULL");
- } else {
- printf("%s", (char*)
col->data[r]);
- }
- break;
+ break;
+ }
+ case monetdbe_str: {
+ monetdbe_column_str * col =
(monetdbe_column_str *) rcol;
+ if (col->is_null(col->data+r)) {
+ printf("NULL");
+ } else {
+ printf("%s", (char*) col->data[r]);
}
- default: {
- printf("UNKNOWN");
- }
+ break;
+ }
+ default: {
+ printf("UNKNOWN");
+ }
}
if (c + 1 < result->ncols) {
@@ -72,8 +72,8 @@ main(void)
}
if ((err = monetdbe_cleanup_result(mdbe, result)) != NULL)
- error(err)
+ error(err);
if (monetdbe_close(mdbe))
- error("Failed to close database")
+ error("Failed to close database");
return 0;
}
diff --git a/ctest/tools/monetdbe/example2.c b/ctest/tools/monetdbe/example2.c
--- a/ctest/tools/monetdbe/example2.c
+++ b/ctest/tools/monetdbe/example2.c
@@ -15,7 +15,7 @@
#include <stdio.h>
#include <inttypes.h>
-#define error(msg) {fprintf(stderr, "Failure: %s\n", msg); return -1;}
+#define error(msg) do{fprintf(stderr, "Failure: %s\n", msg); return
-1;}while(0)
int
main(void)
@@ -27,7 +27,7 @@ main(void)
// second argument is a string for the db directory or NULL for
in-memory mode
if (monetdbe_open(&mdbe, NULL, &opts))
- error("Failed to open database")
+ error("Failed to open database");
if ((err = monetdbe_query(mdbe, "CREATE TABLE test (b bool, t tinyint,
s smallint, x integer, l bigint, "
#ifdef HAVE_HGE
"h hugeint, "
@@ -35,18 +35,18 @@ main(void)
"h bigint, "
#endif
"f float, d double, y string)", NULL, NULL)) != NULL)
- error(err)
+ error(err);
if ((err = monetdbe_query(mdbe, "INSERT INTO test VALUES (TRUE, 42, 42,
42, 42, 42, 42.42, 42.42, 'Hello'), (NULL, NULL, NULL, NULL, NULL, NULL, NULL,
NULL, 'World')", NULL, NULL)) != NULL)
- error(err)
+ error(err);
if ((err = monetdbe_query(mdbe, "SELECT b, t, s, x, l, h, f, d, y FROM
test; ", &result, NULL)) != NULL)
- error(err)
+ error(err);
fprintf(stdout, "Query result with %zu cols and %"PRId64" rows\n",
result->ncols, result->nrows);
for (int64_t r = 0; r < result->nrows; r++) {
for (size_t c = 0; c < result->ncols; c++) {
monetdbe_column* rcol;
if ((err = monetdbe_result_fetch(result, &rcol, c)) !=
NULL)
- error(err)
+ error(err);
switch (rcol->type) {
case monetdbe_bool: {
monetdbe_column_bool * col =
(monetdbe_column_bool *) rcol;
@@ -143,79 +143,79 @@ main(void)
printf("\n");
}
if ((err = monetdbe_cleanup_result(mdbe, result)) != NULL)
- error(err)
+ error(err);
/* test empty results */
if ((err = monetdbe_query(mdbe, "SELECT b, t, s, x, l, h, f, d, y FROM
test where t > 127; ", &result, NULL)) != NULL)
- error(err)
+ error(err);
fprintf(stdout, "Query result with %zu cols and %"PRId64" rows\n",
result->ncols, result->nrows);
for (int64_t r = 0; r < result->nrows; r++) {
/* fetching the meta data should work */
for (size_t c = 0; c < result->ncols; c++) {
monetdbe_column* rcol;
if ((err = monetdbe_result_fetch(result, &rcol, c)) !=
NULL)
- error(err)
+ error(err);
}
}
if ((err = monetdbe_cleanup_result(mdbe, result)) != NULL)
- error(err)
+ error(err);
monetdbe_statement *stmt = NULL;
if ((err = monetdbe_prepare(mdbe, "SELECT b, t FROM test where t = ?;
", &stmt, NULL)) != NULL)
- error(err)
+ error(err);
char s = 42;
if ((err = monetdbe_bind(stmt, &s, 0)) != NULL)
- error(err)
+ error(err);
if ((err = monetdbe_execute(stmt, &result, NULL)) != NULL)
- error(err)
+ error(err);
fprintf(stdout, "Query result with %zu cols and %"PRId64" rows\n",
result->ncols, result->nrows);
if ((err = monetdbe_cleanup_result(mdbe, result)) != NULL)
- error(err)
+ error(err);
if ((err = monetdbe_cleanup_statement(mdbe, stmt)) != NULL)
- error(err)
+ error(err);
/* NULL value version */
if ((err = monetdbe_prepare(mdbe, "SELECT b, t FROM test where t = ?;
", &stmt, NULL)) != NULL)
- error(err)
+ error(err);
char *s2 = NULL;
if ((err = monetdbe_bind(stmt, s2, 0)) != NULL)
- error(err)
+ error(err);
if ((err = monetdbe_execute(stmt, &result, NULL)) != NULL)
- error(err)
+ error(err);
fprintf(stdout, "Query result with %zu cols and %"PRId64" rows\n",
result->ncols, result->nrows);
if ((err = monetdbe_cleanup_result(mdbe, result)) != NULL)
- error(err)
+ error(err);
if ((err = monetdbe_cleanup_statement(mdbe, stmt)) != NULL)
- error(err)
+ error(err);
if ((err = monetdbe_prepare(mdbe, "SELECT b, y FROM test where y = ?;
", &stmt, NULL)) != NULL)
- error(err)
+ error(err);
char *y = "Hello";
if ((err = monetdbe_bind(stmt, y, 0)) != NULL)
- error(err)
+ error(err);
if ((err = monetdbe_execute(stmt, &result, NULL)) != NULL)
- error(err)
+ error(err);
fprintf(stdout, "Query result with %zu cols and %"PRId64" rows\n",
result->ncols, result->nrows);
if ((err = monetdbe_cleanup_result(mdbe, result)) != NULL)
- error(err)
+ error(err);
if ((err = monetdbe_cleanup_statement(mdbe, stmt)) != NULL)
- error(err)
+ error(err);
/* NULL value version */
if ((err = monetdbe_prepare(mdbe, "SELECT b, y FROM test where y = ?;
", &stmt, NULL)) != NULL)
- error(err)
+ error(err);
char *y2 = NULL;
if ((err = monetdbe_bind(stmt, y2, 0)) != NULL)
_______________________________________________
checkin-list mailing list -- [email protected]
To unsubscribe send an email to [email protected]