Changeset: 33285e0d517f for MonetDB
URL: https://dev.monetdb.org/hg/MonetDB?cmd=changeset;node=33285e0d517f
Modified Files:
        configure.ag
        sql/storage/bat/bat_storage.c
        sql/storage/sql_storage.h
        sql/storage/store.c
Branch: linear-hashing
Log Message:

Merged with Nov2019


diffs (133 lines):

diff --git a/configure.ag b/configure.ag
--- a/configure.ag
+++ b/configure.ag
@@ -1200,7 +1200,7 @@ AS_VAR_IF([have_bz2], [no], [], [
                [AC_SUBST([PKG_BZIP2], [bzip2])])
        AS_VAR_IF([have_bz2], [yes],
                [AC_DEFINE([HAVE_LIBBZ2], 1, [Define if you have the bz2 
library])])])
-AM_CONDITIONAL([HAVE_LIBBZ2], [test x"$have_libbz2" != xno])
+AM_CONDITIONAL([HAVE_LIBBZ2], [test x"$have_bz2" != xno])
 
 
 
@@ -1609,12 +1609,12 @@ AC_ARG_WITH([lzma],
                [include lzma support (default=yes)])],
        [have_lzma=$withval])
 AS_VAR_IF([have_lzma], [no], [], [
-       PKG_CHECK_MODULES([liblzma], [liblzma], [have_liblzma=yes], 
[have_liblzma=no; why_not_liblzma="(liblzma not found, install xz-libs and 
xz-devel)"])
-       AS_VAR_IF([have_liblzma], [yes], [
+       PKG_CHECK_MODULES([liblzma], [liblzma], [have_lzma=yes], [have_lzma=no; 
why_not_liblzma="(liblzma not found, install xz-libs and xz-devel)"])
+       AS_VAR_IF([have_lzma], [yes], [
                AC_SUBST([PKG_LIBLZMA], [liblzma])])
-       AS_VAR_IF([have_liblzma], [yes], [
+       AS_VAR_IF([have_lzma], [yes], [
                AC_DEFINE([HAVE_LIBLZMA], 1, [Define if you have the lzma 
library])])])
-AM_CONDITIONAL([HAVE_LIBLZMA], [test x"$have_liblzma" != xno])
+AM_CONDITIONAL([HAVE_LIBLZMA], [test x"$have_lzma" != xno])
 
 org_have_valgrind=no
 have_valgrind=$org_have_valgrind
diff --git a/sql/storage/bat/bat_storage.c b/sql/storage/bat/bat_storage.c
--- a/sql/storage/bat/bat_storage.c
+++ b/sql/storage/bat/bat_storage.c
@@ -2822,7 +2822,7 @@ update_table(sql_trans *tr, sql_table *f
                        }
                }
 
-               oc->type = cc->type;
+               dup_column_sql_type(tr, cc, oc);
                oc->colnr = cc->colnr;
                oc->null = cc->null;
                oc->unique = cc->unique;
diff --git a/sql/storage/sql_storage.h b/sql/storage/sql_storage.h
--- a/sql/storage/sql_storage.h
+++ b/sql/storage/sql_storage.h
@@ -495,4 +495,6 @@ extern sql_part *sql_trans_copy_part(sql
 extern void sql_trans_drop_any_comment(sql_trans *tr, sqlid id);
 extern void sql_trans_drop_obj_priv(sql_trans *tr, sqlid obj_id);
 
+extern void dup_column_sql_type(sql_trans *tr, sql_column *oc, sql_column *nc);
+
 #endif /*SQL_STORAGE_H */
diff --git a/sql/storage/store.c b/sql/storage/store.c
--- a/sql/storage/store.c
+++ b/sql/storage/store.c
@@ -1575,13 +1575,35 @@ create_sql_table(sql_allocator *sa, cons
        return create_sql_table_with_id(sa, next_oid(), name, type, system, 
persistence, commit_action, properties);
 }
 
+void
+dup_column_sql_type(sql_trans *tr, sql_column *oc, sql_column *nc)
+{
+       nc->type = oc->type;
+       if (nc->type.type->s) { /* user type */
+               sql_table *t = oc->t;
+               sql_schema *s = t->s;
+               sql_type *lt = NULL;
+
+               if (s->base.id == nc->type.type->s->base.id) {
+                       /* Current user type belongs to current schema. So 
search there for current user type. */
+                       lt = find_sql_type(s, nc->type.type->base.name);
+               } else {
+                       /* Current user type belongs to another schema in the 
current transaction. Search there for current user type. */
+                       lt = sql_trans_bind_type(tr, NULL, 
nc->type.type->base.name);
+               }
+               if (lt == NULL) 
+                       GDKfatal("SQL type %s missing", 
nc->type.type->base.name);
+               sql_init_subtype(&nc->type, lt, nc->type.digits, 
nc->type.scale);
+       }
+}
+
 static sql_column *
 dup_sql_column(sql_allocator *sa, sql_table *t, sql_column *c)
 {
        sql_column *col = SA_ZNEW(sa, sql_column);
 
        base_init(sa, &col->base, c->base.id, c->base.flags, c->base.name);
-       col->type = c->type;
+       col->type = c->type; /* Both types belong to the same transaction, so 
no dup_column_sql_type call is needed I think */
        col->def = NULL;
        if (c->def)
                col->def = sa_strdup(sa, c->def);
@@ -3112,22 +3134,7 @@ column_dup(sql_trans *tr, int flags, sql
 
        base_init(sa, &c->base, oc->base.id, tr_flag(&oc->base, flags), 
oc->base.name);
        obj_ref(oc,c,flags);
-       c->type = oc->type;
-       if (c->type.type->s) { /* user type */
-               sql_schema *s = t->s;
-               sql_type *lt = NULL;
-
-               if (s->base.id == c->type.type->s->base.id) {
-                       /* Current user type belongs to current schema. So 
search there for current user type. */
-                       lt = find_sql_type(s, c->type.type->base.name);
-               } else {
-                       /* Current user type belongs to another schema in the 
current transaction. Search there for current user type. */
-                       lt = 
sql_trans_bind_type((newFlagSet(flags))?tr->parent:tr, NULL, 
c->type.type->base.name);
-               }
-               if (lt == NULL) 
-                       GDKfatal("SQL type %s missing", 
c->type.type->base.name);
-               sql_init_subtype(&c->type, lt, c->type.digits, c->type.scale);
-       }
+       dup_column_sql_type((newFlagSet(flags))?tr->parent:tr, oc, c);
        c->def = NULL;
        if (oc->def)
                c->def = sa_strdup(sa, oc->def);
@@ -3284,7 +3291,7 @@ sql_trans_copy_column( sql_trans *tr, sq
        if (t->system && sql_trans_name_conflict(tr, t->s->base.name, 
t->base.name, c->base.name))
                return NULL;
        base_init(tr->sa, &col->base, c->base.id, TR_NEW, c->base.name);
-       col->type = c->type;
+       dup_column_sql_type(tr, c, col);
        col->def = NULL;
        if (c->def)
                col->def = sa_strdup(tr->sa, c->def);
@@ -4499,7 +4506,7 @@ reset_column(sql_trans *tr, sql_column *
                                return LOG_ERR;
                }
 
-               fc->type = pfc->type;
+               dup_column_sql_type(tr, pfc, fc);
                fc->null = pfc->null;
                fc->unique = pfc->unique;
                fc->colnr = pfc->colnr;
_______________________________________________
checkin-list mailing list
[email protected]
https://www.monetdb.org/mailman/listinfo/checkin-list

Reply via email to