Changeset: f3fa4abc4ee8 for MonetDB
URL: https://dev.monetdb.org/hg/MonetDB?cmd=changeset;node=f3fa4abc4ee8
Modified Files:
        MonetDB.spec
        NT/Makefile
        NT/rules.msc
        NT/winconfig.py
        buildtools/autogen/autogen/am.py
        buildtools/autogen/autogen/msc.py
        debian/changelog
        monetdb5/optimizer/opt_support.c
        sql/ChangeLog.Jun2020
        sql/backends/monet5/sql_upgrades.c
        sql/scripts/51_sys_schema_extension.sql
        sql/server/rel_select.c
        sql/server/rel_updates.c
        sql/server/sql_parser.y
        sql/server/sql_scan.c
        sql/server/sql_tokens.h
        sql/test/BugTracker-2015/Tests/project_rewrite.Bug-3693.sql
        sql/test/emptydb/Tests/check.stable.out
        sql/test/emptydb/Tests/check.stable.out.32bit
        sql/test/emptydb/Tests/check.stable.out.int128
        sql/test/subquery/Tests/subquery5.sql
        sql/test/subquery/Tests/subquery5.stable.err
        testing/Mtest.py.in
Branch: default
Log Message:

Merged with Jun2020


diffs (truncated from 654 to 300 lines):

diff --git a/MonetDB.spec b/MonetDB.spec
--- a/MonetDB.spec
+++ b/MonetDB.spec
@@ -5062,20 +5062,20 @@ fi
 
 * Fri May 13 2011 Sjoerd Mullender <sjo...@acm.org> - 11.3.3-20110517
 - gdk: Fixed a bug where large files (> 2GB) didn't always get deleted on
-Windows.
+  Windows.
 
 * Wed May 11 2011 Fabian Groffen <fab...@cwi.nl> - 11.3.3-20110517
 - java: Insertion via PreparedStatement and retrieval via ResultSet of 
timestamp
-and time fields with and without timezones was improved to better
-respect timezones, as partly indicated in bug #2781.
+  and time fields with and without timezones was improved to better
+  respect timezones, as partly indicated in bug #2781.
 
 * Wed May 11 2011 Sjoerd Mullender <sjo...@acm.org> - 11.3.3-20110517
 - monetdb5: Fixed a bug in conversion from string to the URL type.  The bug was
-an incorrect call to free().
+  an incorrect call to free().
 
 * Wed Apr 27 2011 Sjoerd Mullender <sjo...@acm.org> - 11.3.3-20110517
 - geom: Fixed various problems so that now all our tests work correctly on
-all our testing platforms.
+  all our testing platforms.
 
 * Thu Apr 21 2011 Sjoerd Mullender <sjo...@acm.org> - 11.3.1-20110421
 - Rebuilt.
diff --git a/NT/Makefile b/NT/Makefile
--- a/NT/Makefile
+++ b/NT/Makefile
@@ -64,7 +64,6 @@ targetdirs:
        if not exist "$(libexecdir)"            $(MKDIR) "$(libexecdir)"
        if not exist "$(datadir)"               $(MKDIR) "$(datadir)"
        if not exist "$(sysconfdir)"            $(MKDIR) "$(sysconfdir)"
-       if not exist "$(sharedstatedir)"        $(MKDIR) "$(sharedstatedir)"
        if not exist "$(localstatedir)"         $(MKDIR) "$(localstatedir)"
        if not exist "$(libdir)"                $(MKDIR) "$(libdir)"
        if not exist "$(infodir)"               $(MKDIR) "$(infodir)"
diff --git a/NT/rules.msc b/NT/rules.msc
--- a/NT/rules.msc
+++ b/NT/rules.msc
@@ -218,7 +218,6 @@ sbindir = $(exec_prefix)\sbin
 libexecdir = $(exec_prefix)\libexec
 datadir = $(prefix)\share
 sysconfdir = $(prefix)\etc
-sharedstatedir = $(prefix)\com
 localstatedir = $(prefix)\var
 libdir = $(exec_prefix)\lib
 infodir = $(prefix)\info
diff --git a/NT/winconfig.py b/NT/winconfig.py
--- a/NT/winconfig.py
+++ b/NT/winconfig.py
@@ -18,7 +18,6 @@ subs = [("@exec_prefix@", r'%prefix%'),
         ("@datadir@", r'%prefix%\share'),
         ("@datarootdir@", r'%prefix%\share'),
         ("@sysconfdir@", r'%prefix%\etc'),
-        ("@sharedstatedir@", r'%prefix%\com'),
         ("@localstatedir@", r'%prefix%\var'),
         ("@libdir@", r'%exec_prefix%\lib'),
         ("@infodir@", r'%prefix%\info'),
diff --git a/buildtools/autogen/autogen/am.py b/buildtools/autogen/autogen/am.py
--- a/buildtools/autogen/autogen/am.py
+++ b/buildtools/autogen/autogen/am.py
@@ -853,7 +853,7 @@ def am_translate_dir(path, am):
                'libdir', 'libexecdir', 'localstatedir', 'mandir',
                'oldincludedir', 'pkgbindir', 'pkgdatadir', 'pkgincludedir',
                'pkglibdir', 'pkglocalstatedir', 'pkgsysconfdir', 'sbindir',
-               'sharedstatedir', 'srcdir', 'sysconfdir', 'top_builddir',
+               'srcdir', 'sysconfdir', 'top_builddir',
                'top_srcdir', 'prefix'):
         dir = "$("+dir+")"
     dir = dir + rest
diff --git a/buildtools/autogen/autogen/msc.py 
b/buildtools/autogen/autogen/msc.py
--- a/buildtools/autogen/autogen/msc.py
+++ b/buildtools/autogen/autogen/msc.py
@@ -147,7 +147,7 @@ def msc_translate_dir(path, msc):
                  'libdir', 'libexecdir', 'localstatedir', 'mandir',
                  'oldincludedir', 'pkgbindir', 'pkgdatadir', 'pkgincludedir',
                  'pkglibdir', 'pkglocalstatedir', 'pkgsysconfdir', 'sbindir',
-                 'sharedstatedir', 'srcdir', 'sysconfdir', 'top_builddir',
+                 'srcdir', 'sysconfdir', 'top_builddir',
                  'top_srcdir', 'prefix'):
         dir = "$("+dir+")"
     if rest:
diff --git a/debian/changelog b/debian/changelog
--- a/debian/changelog
+++ b/debian/changelog
@@ -5846,29 +5846,29 @@ monetdb (11.3.3) unstable; urgency=low
 monetdb (11.3.3) unstable; urgency=low
 
   * gdk: Fixed a bug where large files (> 2GB) didn't always get deleted on
-Windows.
+    Windows.
 
  -- Sjoerd Mullender <sjo...@acm.org>  Fri, 13 May 2011 16:45:38 +0200
 
 monetdb (11.3.3) unstable; urgency=low
 
   * java: Insertion via PreparedStatement and retrieval via ResultSet of 
timestamp
-and time fields with and without timezones was improved to better
-respect timezones, as partly indicated in bug #2781.
+    and time fields with and without timezones was improved to better
+    respect timezones, as partly indicated in bug #2781.
 
  -- Fabian Groffen <fab...@cwi.nl>  Wed, 11 May 2011 16:45:38 +0200
 
 monetdb (11.3.3) unstable; urgency=low
 
   * monetdb5: Fixed a bug in conversion from string to the URL type.  The bug 
was
-an incorrect call to free().
+    an incorrect call to free().
 
  -- Sjoerd Mullender <sjo...@acm.org>  Wed, 11 May 2011 16:45:38 +0200
 
 monetdb (11.3.3) unstable; urgency=low
 
   * geom: Fixed various problems so that now all our tests work correctly on
-all our testing platforms.
+    all our testing platforms.
 
  -- Sjoerd Mullender <sjo...@acm.org>  Wed, 27 Apr 2011 16:45:38 +0200
 
diff --git a/monetdb5/optimizer/opt_support.c b/monetdb5/optimizer/opt_support.c
--- a/monetdb5/optimizer/opt_support.c
+++ b/monetdb5/optimizer/opt_support.c
@@ -302,7 +302,8 @@ isUpdateInstruction(InstrPtr p){
                getFunctionId(p) == updateRef ||
                getFunctionId(p) == deleteRef ||
                getFunctionId(p) == growRef ||
-               getFunctionId(p) == clear_tableRef))
+               getFunctionId(p) == clear_tableRef ||
+               getFunctionId(p) == setVariableRef))
                        return TRUE;
        if ( getModuleId(p) == batRef &&
           ( getFunctionId(p) == appendRef ||
diff --git a/sql/ChangeLog.Jun2020 b/sql/ChangeLog.Jun2020
--- a/sql/ChangeLog.Jun2020
+++ b/sql/ChangeLog.Jun2020
@@ -1,6 +1,10 @@
 # ChangeLog file for sql
 # This file is updated with Maddlog
 
+* Wed Apr 15 2020 Pedro Ferreira <pedro.ferre...@monetdbsolutions.com>
+- Removed UNION JOIN statements. They were dropped by the SQL:2003
+  standard, plus MonetDB implementation was not fully compliant.
+
 * Wed Apr  1 2020 Sjoerd Mullender <sjo...@acm.org>
 - The OFFSET value in the COPY INTO query now counts uninterpreted
   newlines.  Before it counted "unquoted record separators" which meant
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
@@ -2734,6 +2734,11 @@ sql_update_jun2020(Client c, mvc *sql, c
                        "update sys._tables set system = true where schema_id = 
(select id from sys.schemas where name = 'logging')"
                        " and name = 'compinfo';\n");
 
+       /* 51_sys_schema_extensions */
+       pos += snprintf(buf + pos, bufsize - pos,
+                       "ALTER TABLE sys.keywords SET READ WRITE;\n"
+                       "DELETE FROM sys.keywords where \"keyword\" = 
'UNIONJOIN';\n");
+
        pos += snprintf(buf + pos, bufsize - pos, "commit;\n");
        pos += snprintf(buf + pos, bufsize - pos, "set schema \"%s\";\n", 
prev_schema);
        assert(pos < bufsize);
diff --git a/sql/scripts/51_sys_schema_extension.sql 
b/sql/scripts/51_sys_schema_extension.sql
--- a/sql/scripts/51_sys_schema_extension.sql
+++ b/sql/scripts/51_sys_schema_extension.sql
@@ -268,7 +268,6 @@ INSERT INTO sys.keywords (keyword) VALUE
   ('UNCOMMITTED'),
   ('UNENCRYPTED'),
   ('UNION'),
-  ('UNIONJOIN'),
   ('UNIQUE'),
   ('UPDATE'),
   ('USER'),
diff --git a/sql/server/rel_select.c b/sql/server/rel_select.c
--- a/sql/server/rel_select.c
+++ b/sql/server/rel_select.c
@@ -160,7 +160,6 @@ rel_orderby(mvc *sql, sql_rel *l)
 static sql_rel * rel_setquery(sql_query *query, symbol *sq);
 static sql_rel * rel_joinquery(sql_query *query, sql_rel *rel, symbol *sq);
 static sql_rel * rel_crossquery(sql_query *query, sql_rel *rel, symbol *q);
-static sql_rel * rel_unionjoinquery(sql_query *query, sql_rel *rel, symbol 
*sq);
 
 static sql_rel *
 rel_table_optname(mvc *sql, sql_rel *sq, symbol *optname)
@@ -340,14 +339,6 @@ query_exp_optname(sql_query *query, sql_
                        return NULL;
                return rel_table_optname(sql, tq, q->data.lval->t->data.sym);
        }
-       case SQL_UNIONJOIN:
-       {
-               sql_rel *tq = rel_unionjoinquery(query, r, q);
-
-               if (!tq)
-                       return NULL;
-               return rel_table_optname(sql, tq, q->data.lval->t->data.sym);
-       }
        default:
                (void) sql_error(sql, 02, SQLSTATE(42000) "case %d %s", (int) 
q->token, token2string(q->token));
        }
@@ -4414,6 +4405,8 @@ rel_order_by(sql_query *query, sql_rel *
                                        if (!found) {
                                                append(rel->exps, e);
                                        } else {
+                                               if (!exp_name(found))
+                                                       exp_label(sql->sa, 
found, ++sql->label);
                                                e = found;
                                        }
                                        e = exp_ref(sql->sa, e);
@@ -5635,10 +5628,11 @@ rel_query(sql_query *query, sql_rel *rel
 
        if (sn->from) {         /* keep variable list with tables and names */
                dlist *fl = sn->from->data.lval;
-               dnode *n = NULL;
                sql_rel *fnd = NULL;
-
-               for (n = fl->h; n ; n = n->next) {
+               list *names = new_exp_list(sql->sa);
+
+               for (dnode *n = fl->h; n ; n = n->next) {
+                       char *nrame = NULL;
                        int lateral = check_is_lateral(n->data.sym);
 
                        /* just used current expression */
@@ -5654,6 +5648,14 @@ rel_query(sql_query *query, sql_rel *rel
                        }
                        if (!fnd)
                                break;
+                       if ((nrame = (char*) rel_name(fnd))) {
+                               if (list_find(names, nrame, (fcmp) &strcmp)) {
+                                       if (res)
+                                               rel_destroy(res);
+                                       return sql_error(sql, 01, 
SQLSTATE(42000) "SELECT: relation name \"%s\" specified more than once", nrame);
+                               } else
+                                       list_append(names, nrame);
+                       }
                        if (res) {
                                res = rel_crossproduct(sql->sa, res, fnd, 
op_join);
                                if (lateral)
@@ -5913,6 +5915,7 @@ rel_joinquery(sql_query *query, sql_rel 
 static sql_rel *
 rel_crossquery(sql_query *query, sql_rel *rel, symbol *q)
 {
+       mvc *sql = query->sql;
        dnode *n = q->data.lval->h;
        symbol *tab1 = n->data.sym;
        symbol *tab2 = n->next->data.sym;
@@ -5924,59 +5927,10 @@ rel_crossquery(sql_query *query, sql_rel
        if (!t1 || !t2)
                return NULL;
 
-       rel = rel_crossproduct(query->sql->sa, t1, t2, op_join);
-       return rel;
-}
-       
-static sql_rel *
-rel_unionjoinquery(sql_query *query, sql_rel *rel, symbol *q)
-{
-       mvc *sql = query->sql;
-       dnode *n = q->data.lval->h;
-       sql_rel *lv = table_ref(query, rel, n->data.sym, 0);
-       sql_rel *rv = NULL;
-       int all = n->next->data.i_val;
-       list *lexps, *rexps;
-       node *m;
-       int found = 0;
-
-       if (lv)
-               rv = table_ref(query, rel, n->next->next->data.sym, 0);
-       assert(n->next->type == type_int);
-       if (!lv || !rv)
-               return NULL;
-
-       lexps = rel_projections(sql, lv, NULL, 1, 1);
-       /* find the matching columns (all should match?)
-        * union these
-        * if !all do a distinct operation at the end
-        */
-       /* join all result columns ie join(lh,rh) on column_name */
-       rexps = new_exp_list(sql->sa);
-       for (m = lexps->h; m; m = m->next) {
-               sql_exp *le = m->data;
-               sql_exp *rc = rel_bind_column(sql, rv, exp_name(le), sql_where 
| sql_join, 0);
-
-               if (!rc && all)
-                       break;
-               if (rc) {
-                       found = 1;
-                       append(rexps, rc);
-               }
-       }
-       if (!found) {
-               rel_destroy(rel);
-               return NULL;
-       }
-       lv = rel_project(sql->sa, lv, lexps);
-       rv = rel_project(sql->sa, rv, rexps);
_______________________________________________
checkin-list mailing list
checkin-list@monetdb.org
https://www.monetdb.org/mailman/listinfo/checkin-list

Reply via email to