Changeset: d77a9b1a433a for MonetDB
URL: http://dev.monetdb.org/hg/MonetDB?cmd=changeset;node=d77a9b1a433a
Added Files:
        sql/test/testdb-upgrade-chain/Tests/upgrade.stable.out.int128
        sql/test/testdb-upgrade/Tests/upgrade.stable.out.int128
Modified Files:
        clients/Tests/MAL-signatures_all.stable.out
        clients/Tests/MAL-signatures_all.stable.out.int128
        clients/Tests/MAL-signatures_fits_geom.stable.out
        clients/Tests/MAL-signatures_fits_geom.stable.out.int128
        clients/Tests/MAL-signatures_geom.stable.out
        clients/Tests/MAL-signatures_geom.stable.out.int128
        clients/Tests/MAL-signatures_none.stable.out
        clients/Tests/MAL-signatures_none.stable.out.int128
        gdk/gdk_bbp.c
        sql/backends/monet5/sql_upgrades.c
        sql/common/sql_types.c
        sql/storage/bat/bat_logger.c
        sql/test/pg_regress/Tests/All
        sql/test/pg_regress/Tests/geometry.sql
        sql/test/pg_regress/Tests/path.sql
        sql/test/pg_regress/Tests/path.stable.err
        sql/test/pg_regress/Tests/path.stable.out
        sql/test/pg_regress/postgresql2sql99.sh
Branch: resultset
Log Message:

Merge with default


diffs (truncated from 1062 to 300 lines):

diff --git a/clients/Tests/MAL-signatures_all.stable.out 
b/clients/Tests/MAL-signatures_all.stable.out
--- a/clients/Tests/MAL-signatures_all.stable.out
+++ b/clients/Tests/MAL-signatures_all.stable.out
@@ -39156,6 +39156,8 @@ command inet.broadcast(X_1:inet):inet
 address INETbroadcast;
 comment Returns the broadcast address for network
 
+command inet.#cmp():int 
+address INETcompare;
 command inet.#fromstr():void 
 address INETfromString;
 comment Convert a string to an inet
diff --git a/clients/Tests/MAL-signatures_all.stable.out.int128 
b/clients/Tests/MAL-signatures_all.stable.out.int128
--- a/clients/Tests/MAL-signatures_all.stable.out.int128
+++ b/clients/Tests/MAL-signatures_all.stable.out.int128
@@ -50123,6 +50123,8 @@ command inet.broadcast(X_1:inet):inet
 address INETbroadcast;
 comment Returns the broadcast address for network
 
+command inet.#cmp():int 
+address INETcompare;
 command inet.#fromstr():void 
 address INETfromString;
 comment Convert a string to an inet
diff --git a/clients/Tests/MAL-signatures_fits_geom.stable.out 
b/clients/Tests/MAL-signatures_fits_geom.stable.out
--- a/clients/Tests/MAL-signatures_fits_geom.stable.out
+++ b/clients/Tests/MAL-signatures_fits_geom.stable.out
@@ -39073,6 +39073,8 @@ command inet.broadcast(X_1:inet):inet
 address INETbroadcast;
 comment Returns the broadcast address for network
 
+command inet.#cmp():int 
+address INETcompare;
 command inet.#fromstr():void 
 address INETfromString;
 comment Convert a string to an inet
diff --git a/clients/Tests/MAL-signatures_fits_geom.stable.out.int128 
b/clients/Tests/MAL-signatures_fits_geom.stable.out.int128
--- a/clients/Tests/MAL-signatures_fits_geom.stable.out.int128
+++ b/clients/Tests/MAL-signatures_fits_geom.stable.out.int128
@@ -50045,6 +50045,8 @@ command inet.broadcast(X_1:inet):inet
 address INETbroadcast;
 comment Returns the broadcast address for network
 
+command inet.#cmp():int 
+address INETcompare;
 command inet.#fromstr():void 
 address INETfromString;
 comment Convert a string to an inet
diff --git a/clients/Tests/MAL-signatures_geom.stable.out 
b/clients/Tests/MAL-signatures_geom.stable.out
--- a/clients/Tests/MAL-signatures_geom.stable.out
+++ b/clients/Tests/MAL-signatures_geom.stable.out
@@ -39049,6 +39049,8 @@ command inet.broadcast(X_1:inet):inet
 address INETbroadcast;
 comment Returns the broadcast address for network
 
+command inet.#cmp():int 
+address INETcompare;
 command inet.#fromstr():void 
 address INETfromString;
 comment Convert a string to an inet
diff --git a/clients/Tests/MAL-signatures_geom.stable.out.int128 
b/clients/Tests/MAL-signatures_geom.stable.out.int128
--- a/clients/Tests/MAL-signatures_geom.stable.out.int128
+++ b/clients/Tests/MAL-signatures_geom.stable.out.int128
@@ -50021,6 +50021,8 @@ command inet.broadcast(X_1:inet):inet
 address INETbroadcast;
 comment Returns the broadcast address for network
 
+command inet.#cmp():int 
+address INETcompare;
 command inet.#fromstr():void 
 address INETfromString;
 comment Convert a string to an inet
diff --git a/clients/Tests/MAL-signatures_none.stable.out 
b/clients/Tests/MAL-signatures_none.stable.out
--- a/clients/Tests/MAL-signatures_none.stable.out
+++ b/clients/Tests/MAL-signatures_none.stable.out
@@ -38878,6 +38878,8 @@ command inet.broadcast(X_1:inet):inet
 address INETbroadcast;
 comment Returns the broadcast address for network
 
+command inet.#cmp():int 
+address INETcompare;
 command inet.#fromstr():void 
 address INETfromString;
 comment Convert a string to an inet
diff --git a/clients/Tests/MAL-signatures_none.stable.out.int128 
b/clients/Tests/MAL-signatures_none.stable.out.int128
--- a/clients/Tests/MAL-signatures_none.stable.out.int128
+++ b/clients/Tests/MAL-signatures_none.stable.out.int128
@@ -49849,6 +49849,8 @@ command inet.broadcast(X_1:inet):inet
 address INETbroadcast;
 comment Returns the broadcast address for network
 
+command inet.#cmp():int 
+address INETcompare;
 command inet.#fromstr():void 
 address INETfromString;
 comment Convert a string to an inet
diff --git a/gdk/gdk_bbp.c b/gdk/gdk_bbp.c
--- a/gdk/gdk_bbp.c
+++ b/gdk/gdk_bbp.c
@@ -987,7 +987,7 @@ BBPheader(FILE *fp, oid *BBPoid, int *OI
                         "expected pointer size %d, got %d, expected OID size 
%d, got %d.",
                         SIZEOF_SIZE_T, ptrsize, SIZEOF_OID, oidsize);
        }
-       if (intsize != SIZEOF_MAX_INT) {
+       if (intsize > SIZEOF_MAX_INT) {
                GDKfatal("BBPinit: database created with incompatible server:\n"
                         "expected max. integer size %d, got %d.",
                         SIZEOF_MAX_INT, intsize);
diff --git a/sql/backends/monet5/sql_upgrades.c 
b/sql/backends/monet5/sql_upgrades.c
--- a/sql/backends/monet5/sql_upgrades.c
+++ b/sql/backends/monet5/sql_upgrades.c
@@ -1010,6 +1010,113 @@ sql_update_oct2014_sp1(Client c)
        return err;             /* usually MAL_SUCCEED */
 }
 
+#ifdef HAVE_HGE
+static str
+sql_update_hugeint(Client c)
+{
+       size_t bufsize = 8192, pos = 0;
+       char *buf = GDKmalloc(bufsize), *err = NULL;
+       mvc *sql = ((backend*) c->sqlcontext)->mvc;
+       ValRecord *schvar = stack_get_var(sql, "current_schema");
+       char *schema = NULL;
+
+       if (schvar)
+               schema = strdup(schvar->val.sval);
+
+       pos += snprintf(buf + pos, bufsize - pos, "set schema \"sys\";\n");
+
+       pos += snprintf(buf + pos, bufsize - pos, "create function sys.fuse(one 
bigint, two bigint)\n");
+       pos += snprintf(buf + pos, bufsize - pos, "returns hugeint\n");
+       pos += snprintf(buf + pos, bufsize - pos, "external name udf.fuse;\n");
+
+       pos += snprintf(buf + pos, bufsize - pos, "create function 
sys.generate_series(first hugeint, last hugeint)\n");
+       pos += snprintf(buf + pos, bufsize - pos, "returns table (value 
hugeint)\n");
+       pos += snprintf(buf + pos, bufsize - pos, "external name 
generator.series;\n");
+
+       pos += snprintf(buf + pos, bufsize - pos, "create function 
sys.generate_series(first hugeint, last hugeint, stepsize hugeint)\n");
+       pos += snprintf(buf + pos, bufsize - pos, "returns table (value 
hugeint)\n");
+       pos += snprintf(buf + pos, bufsize - pos, "external name 
generator.series;\n");
+
+       pos += snprintf(buf + pos, bufsize - pos, "create aggregate 
sys.stddev_samp(val hugeint)\n");
+       pos += snprintf(buf + pos, bufsize - pos, "returns double\n");
+       pos += snprintf(buf + pos, bufsize - pos, "external name 
aggr.stdev;\n");
+
+       pos += snprintf(buf + pos, bufsize - pos, "create aggregate 
sys.stddev_pop(val hugeint)\n");
+       pos += snprintf(buf + pos, bufsize - pos, "returns double\n");
+       pos += snprintf(buf + pos, bufsize - pos, "external name 
aggr.stdevp;\n");
+
+       pos += snprintf(buf + pos, bufsize - pos, "create aggregate 
sys.var_samp(val hugeint)\n");
+       pos += snprintf(buf + pos, bufsize - pos, "returns double\n");
+       pos += snprintf(buf + pos, bufsize - pos, "external name 
aggr.variance;\n");
+
+       pos += snprintf(buf + pos, bufsize - pos, "create aggregate 
sys.var_pop(val hugeint)\n");
+       pos += snprintf(buf + pos, bufsize - pos, "returns double\n");
+       pos += snprintf(buf + pos, bufsize - pos, "external name 
aggr.variancep;\n");
+
+       pos += snprintf(buf + pos, bufsize - pos, "create aggregate 
sys.median(val hugeint)\n");
+       pos += snprintf(buf + pos, bufsize - pos, "returns hugeint\n");
+       pos += snprintf(buf + pos, bufsize - pos, "external name 
aggr.median;\n");
+
+       pos += snprintf(buf + pos, bufsize - pos, "create aggregate 
sys.quantile(val hugeint, q double)\n");
+       pos += snprintf(buf + pos, bufsize - pos, "returns hugeint\n");
+       pos += snprintf(buf + pos, bufsize - pos, "external name 
aggr.quantile;\n");
+
+       pos += snprintf(buf + pos, bufsize - pos, "create aggregate sys.corr(e1 
hugeint, e2 hugeint)\n");
+       pos += snprintf(buf + pos, bufsize - pos, "returns hugeint\n");
+       pos += snprintf(buf + pos, bufsize - pos, "external name aggr.corr;\n");
+
+       pos += snprintf(buf + pos, bufsize - pos, "create function 
json.filter(js json, name hugeint)\n");
+       pos += snprintf(buf + pos, bufsize - pos, "returns json\n");
+       pos += snprintf(buf + pos, bufsize - pos, "external name 
json.filter;\n");
+       pos += snprintf(buf + pos, bufsize - pos, "drop view 
sys.tablestoragemodel;\n");
+       pos += snprintf(buf + pos, bufsize - pos, "create view 
sys.tablestoragemodel\n");
+       pos += snprintf(buf + pos, bufsize - pos, "as select 
\"schema\",\"table\",max(count) as \"count\",\n");
+       pos += snprintf(buf + pos, bufsize - pos, "\tsum(columnsize) as 
columnsize,\n");
+       pos += snprintf(buf + pos, bufsize - pos, "\tsum(heapsize) as 
heapsize,\n");
+       pos += snprintf(buf + pos, bufsize - pos, "\tsum(hashes) as hashes,\n");
+       pos += snprintf(buf + pos, bufsize - pos, "\tsum(imprints) as 
imprints,\n");
+       pos += snprintf(buf + pos, bufsize - pos, "\tsum(case when sorted = 
false then 8 * count else 0 end) as auxillary\n");
+       pos += snprintf(buf + pos, bufsize - pos, "from sys.storagemodel() 
group by \"schema\",\"table\";\n");
+
+       pos += snprintf(buf + pos, bufsize - pos, "insert into 
sys.systemfunctions (select id from sys.functions where name in ('fuse', 
'generate_series', 'stddev_samp', 'stddev_pop', 'var_samp', 'var_pop', 
'median', 'quantile', 'corr', 'tablestoragemodel') and schema_id = (select id 
from sys.schemas where name = 'sys') and id not in (select function_id from 
sys.systemfunctions));\n");
+       pos += snprintf(buf + pos, bufsize - pos, "insert into 
sys.systemfunctions (select id from sys.functions where name = 'filter' and 
schema_id = (select id from sys.schemas where name = 'json') and id not in 
(select function_id from sys.systemfunctions));\n");
+       pos += snprintf(buf + pos, bufsize - pos, "update sys._tables set 
system = true where name = 'tablestoragemodel' and schema_id = (select id from 
sys.schemas where name = 'sys');\n");
+
+       pos += snprintf(buf + pos, bufsize - pos, "insert into sys.types 
values(%d, 'hge', 'hugeint', 128, 1, 2, 6, 0);\n", store_next_oid());
+       pos += snprintf(buf + pos, bufsize - pos, "insert into sys.types 
values(%d, 'hge', 'decimal', 39, 1, 10, 8, 0);\n", store_next_oid());
+       pos += snprintf(buf + pos, bufsize - pos, "update sys.types set digits 
= 18 where systemname = 'lng' and sqlname = 'decimal';\n");
+
+       {
+               char *msg;
+               mvc *sql = NULL;
+
+               if ((msg = getSQLContext(c, c->curprg->def, &sql, NULL)) != 
MAL_SUCCEED) {
+                       GDKfree(msg);
+               } else {
+                       sql_schema *s;
+
+                       if ((s = mvc_bind_schema(sql, "sys")) != NULL) {
+                               sql_table *t;
+
+                               if ((t = mvc_bind_table(sql, s, 
"tablestoragemodel")) != NULL)
+                                       t->system = 0;
+                       }
+               }
+       }
+
+       if (schema) {
+               pos += snprintf(buf + pos, bufsize - pos, "set schema 
\"%s\";\n", schema);
+               free(schema);
+       }
+       assert(pos < bufsize);
+
+       printf("Running database upgrade commands:\n%s\n", buf);
+       err = SQLstatementIntern(c, &buf, "update", 1, 0, NULL);
+       GDKfree(buf);
+       return err;             /* usually MAL_SUCCEED */
+}
+#endif
+
 static str
 sql_update_feb2015(Client c)
 {
@@ -1105,6 +1212,17 @@ SQLupgrades(Client c, mvc *m)
                        GDKfree(err);
                }
        }
+
+#ifdef HAVE_HGE
+       sql_find_subtype(&tp, "hugeint", 0, 0);
+       if (!sql_bind_aggr(m->sa, mvc_bind_schema(m, "sys"), "var_pop", &tp)) {
+               if ((err = sql_update_hugeint(c)) != NULL) {
+                       fprintf(stderr, "!%s\n", err);
+                       GDKfree(err);
+               }
+       }
+#endif
+
        /* add missing features needed beyond Oct 2014 */
        sql_find_subtype(&tp, "timestamp", 0, 0);
        if ( 0 &&  !sql_bind_func(m->sa, mvc_bind_schema(m, "sys"), "epoch", 
&tp, NULL, F_FUNC) ){
diff --git a/sql/common/sql_types.c b/sql/common/sql_types.c
--- a/sql/common/sql_types.c
+++ b/sql/common/sql_types.c
@@ -1110,8 +1110,7 @@ many of the function signatures can be o
 database kernel, we have chosen for this explicit scheme for one
 simple reason. The SQL standard dictates the types and we have to
 check their availability in the kernel only. The kernel itself could
-include manyfunctions for which their is no standard.
-lead to unexpected
+include many functions for which there is no standard.
 */
 
 static void
diff --git a/sql/storage/bat/bat_logger.c b/sql/storage/bat/bat_logger.c
--- a/sql/storage/bat/bat_logger.c
+++ b/sql/storage/bat/bat_logger.c
@@ -26,11 +26,6 @@ logger *bat_logger = NULL;
 static int
 bl_preversion( int oldversion, int newversion)
 {
-#define CATALOG_FEB2010 50000
-#define CATALOG_OCT2010 51000
-#define CATALOG_APR2011 51100
-#define CATALOG_AUG2011 51101
-#define CATALOG_DEC2011 52000
 #define CATALOG_FEB2013 52001
 
        (void)newversion;
@@ -38,22 +33,6 @@ bl_preversion( int oldversion, int newve
                catalog_version = oldversion;
                return 0;
        }
-       if (oldversion == CATALOG_OCT2010) {
-               catalog_version = oldversion;
-               return 0;
-       }
-       if (oldversion == CATALOG_APR2011) {
-               catalog_version = oldversion;
-               return 0;
-       }
-       if (oldversion == CATALOG_AUG2011) {
-               catalog_version = oldversion;
-               return 0;
-       }
-       if (oldversion == CATALOG_DEC2011) {
-               catalog_version = oldversion;
-               return 0;
-       }
        return -1;
 }
 
@@ -67,13 +46,6 @@ N( char *buf, char *pre, char *schema, c
        return buf;
 }
 
-static char *
-I( char *buf, char *schema, char *table, char *iname)
_______________________________________________
checkin-list mailing list
[email protected]
https://www.monetdb.org/mailman/listinfo/checkin-list

Reply via email to