MonetDB: Dec2023 - Implemented command line option --run-until t...

2024-05-29 Thread Sjoerd Mullender via checkin-list
Changeset: eed539e87d70 for MonetDB
URL: https://dev.monetdb.org/hg/MonetDB/rev/eed539e87d70
Modified Files:
testing/sqllogictest.py
Branch: Dec2023
Log Message:

Implemented command line option --run-until to specify line number to stop 
testing.
Up to the specified number of lines are read from each of the test files
on the command line.


diffs (55 lines):

diff --git a/testing/sqllogictest.py b/testing/sqllogictest.py
--- a/testing/sqllogictest.py
+++ b/testing/sqllogictest.py
@@ -656,10 +656,11 @@ class SQLLogic:
 result2 = result
 return result1, result2
 
-def initfile(self, f, defines):
+def initfile(self, f, defines, run_until=None):
 self.name = f
 self.file = open(f, 'r', encoding='utf-8', errors='replace')
 self.line = 0
+self.run_until = run_until
 self.hashes = {}
 defs = []
 if defines:
@@ -674,6 +675,8 @@ class SQLLogic:
 
 def readline(self):
 self.line += 1
+if self.run_until and self.line >= self.run_until:
+return ''
 origline = line = self.file.readline()
 for reg, val, key in self.defines:
 line = reg.sub(val.replace('\\', r'\\'), line)
@@ -736,9 +739,9 @@ class SQLLogic:
 self.raise_error('invalid connection parameters definition, 
username or password missing!')
 return res
 
-def parse(self, f, approve=None, verbose=False, defines=None):
+def parse(self, f, approve=None, verbose=False, defines=None, 
run_until=None):
 self.approve = approve
-self.initfile(f, defines)
+self.initfile(f, defines, run_until=run_until)
 nthreads = None
 if self.language == 'sql':
 self.crs.execute(f'call sys.setsessiontimeout({self.timeout or 
0})')
@@ -945,6 +948,8 @@ if __name__ == '__main__':
 ' (can be repeated)')
 parser.add_argument('--alltests', action='store_true',
 help='also executed "knownfail" tests')
+parser.add_argument('--run-until', action='store', type=int,
+help='run tests until specified line')
 parser.add_argument('tests', nargs='*', help='tests to be run')
 opts = parser.parse_args()
 args = opts.tests
@@ -959,7 +964,7 @@ if __name__ == '__main__':
 print('now testing {}'. format(test))
 try:
 sql.parse(test, approve=opts.approve, verbose=opts.verbose,
-  defines=opts.define)
+  defines=opts.define, run_until=opts.run_until)
 except SQLLogicSyntaxError:
 pass
 except BrokenPipeError:
___
checkin-list mailing list -- checkin-list@monetdb.org
To unsubscribe send an email to checkin-list-le...@monetdb.org


MonetDB: default - Use utf-8 decode function in more places.

2024-05-29 Thread Sjoerd Mullender via checkin-list
Changeset: 450f65bcb3e5 for MonetDB
URL: https://dev.monetdb.org/hg/MonetDB/rev/450f65bcb3e5
Modified Files:
clients/odbc/driver/CMakeLists.txt
clients/odbc/driver/ODBCUtil.c
common/stream/CMakeLists.txt
common/stream/stdio_stream.c
common/stream/winio.c
common/utils/CMakeLists.txt
common/utils/mutils.c
Branch: default
Log Message:

Use utf-8 decode function in more places.


diffs (truncated from 430 to 300 lines):

diff --git a/clients/odbc/driver/CMakeLists.txt 
b/clients/odbc/driver/CMakeLists.txt
--- a/clients/odbc/driver/CMakeLists.txt
+++ b/clients/odbc/driver/CMakeLists.txt
@@ -133,6 +133,7 @@ target_link_libraries(MonetODBC
   monetdb_config_header
   mutils
   mapi
+  mutf8
   ${ODBCINST_LIBRARIES})
 
 install(TARGETS
diff --git a/clients/odbc/driver/ODBCUtil.c b/clients/odbc/driver/ODBCUtil.c
--- a/clients/odbc/driver/ODBCUtil.c
+++ b/clients/odbc/driver/ODBCUtil.c
@@ -35,6 +35,7 @@
 #include "ODBCUtil.h"
 #include "ODBCDbc.h"
 #include 
+#include "mutf8.h"
 
 
 #ifdef WIN32
@@ -199,7 +200,6 @@ ODBCutf82wchar(const SQLCHAR *src,
 {
SQLLEN i = 0;
SQLINTEGER j = 0;
-   uint32_t c;
 
if (buf == NULL)
buflen = 0;
@@ -220,51 +220,25 @@ ODBCutf82wchar(const SQLCHAR *src,
else if (length < 0)
return "Invalid length parameter";
 
+   uint32_t state = 0, codepoint = 0;
while (j < length && i + 1 < buflen && src[j]) {
-   if ((src[j+0] & 0x80) == 0) {
-   buf[i++] = src[j+0];
-   j += 1;
-   } else if (j + 1 < length
-  && (src[j+0] & 0xE0) == 0xC0
-  && (src[j+1] & 0xC0) == 0x80
-  && (src[j+0] & 0x1E) != 0) {
-   buf[i++] = (src[j+0] & 0x1F) << 6
-   | (src[j+1] & 0x3F);
-   j += 2;
-   } else if (j + 2 < length
-  && (src[j+0] & 0xF0) == 0xE0
-  && (src[j+1] & 0xC0) == 0x80
-  && (src[j+2] & 0xC0) == 0x80
-  && ((src[j+0] & 0x0F) != 0
-  || (src[j+1] & 0x20) != 0)) {
-   buf[i++] = (src[j+0] & 0x0F) << 12
-   | (src[j+1] & 0x3F) << 6
-   | (src[j+2] & 0x3F);
-   j += 3;
-   } else if (j + 3 < length
-  && (src[j+0] & 0xF8) == 0xF0
-  && (src[j+1] & 0xC0) == 0x80
-  && (src[j+2] & 0xC0) == 0x80
-  && (src[j+3] & 0xC0) == 0x80
-  && ((src[j+0] & 0x07) != 0
-  || (src[j+1] & 0x30) != 0)) {
-   c = (src[j+0] & 0x07) << 18
-   | (src[j+1] & 0x3F) << 12
-   | (src[j+2] & 0x3F) << 6
-   | (src[j+3] & 0x3F);
-   if (c > 0x10 || (c & 0x1FF800) == 0x00D800)
-   return "Illegal code point";
+   switch (decode(&state, &codepoint, (uint8_t) src[j++])) {
+   case UTF8_ACCEPT:
 #if SIZEOF_SQLWCHAR == 2
-   if (i + 2 >= buflen)
-   break;
-   buf[i++] = 0xD7C0 + (c >> 10);
-   buf[i++] = 0xDC00 + (c & 0x03FF);
+   if (codepoint <= 0x) {
+   buf[i++] = (SQLWCHAR) codepoint;
+   } else {
+   buf[i++] = (SQLWCHAR) (0xD7C0 + (codepoint >> 
10));
+   buf[i++] = (SQLWCHAR) (0xDC00 + (codepoint & 
0x3FF));
+   }
 #else
-   buf[i++] = c;
+   buf[i++] = (SQLWCHAR) codepoint;
 #endif
-   j += 4;
-   } else {
+   break;
+   case UTF8_REJECT:
return "Illegal code point";
+   default:
+   break;
}
}
if (buflen > 0)
@@ -272,40 +246,22 @@ ODBCutf82wchar(const SQLCHAR *src,
if (consumed)
*consumed = (size_t) j;
while (j < length && src[j]) {
-   i++;
-   if ((src[j+0] & 0x80) == 0) {
-   j += 1;
-   } else if (j + 1 < length
-  && (src[j+0] & 0xE0) == 0xC0
-  && (src[j+1] & 0xC0) == 0x80
-  && (src[j+0] & 0x1E) != 0) {
-   j += 2;
-   } else if (j + 2 < length
-  && (src[j+0] & 0xF0) == 0xE0
-  && (src[j+1] & 0xC0) == 0x80
-  && (src[j+2] & 0xC0) == 0x80
- 

MonetDB: default - Put charwidth function and table in separate ...

2024-05-29 Thread Sjoerd Mullender via checkin-list
Changeset: 7bc945921cc9 for MonetDB
URL: https://dev.monetdb.org/hg/MonetDB/rev/7bc945921cc9
Added Files:
common/utils/mwidth.c
Modified Files:
common/utils/CMakeLists.txt
common/utils/mutf8.c
Branch: default
Log Message:

Put charwidth function and table in separate object file in archive.
This way, it doesn't have to be included in objects that use the decode
function but not the charwidth function.


diffs (truncated from 458 to 300 lines):

diff --git a/common/utils/CMakeLists.txt b/common/utils/CMakeLists.txt
--- a/common/utils/CMakeLists.txt
+++ b/common/utils/CMakeLists.txt
@@ -157,7 +157,8 @@ target_sources(mutf8
   PUBLIC
   ${CMAKE_CURRENT_SOURCE_DIR}/mutf8.h
   PRIVATE
-  mutf8.c)
+  mutf8.c
+  mwidth.c)
 
 target_include_directories(mutf8
   PUBLIC
diff --git a/common/utils/mutf8.c b/common/utils/mutf8.c
--- a/common/utils/mutf8.c
+++ b/common/utils/mutf8.c
@@ -13,214 +13,6 @@
 #include "monetdb_config.h"
 #include "mutf8.h"
 
-struct interval {
-   uint32_t first;
-   uint32_t last;
-   int width;
-};
-
-/* this table was created using the script uniwidthtab.sh */
-static const struct interval intervals[] = {
-   /* sorted list of non-overlapping ranges:
-* ranges with width==0 represent all codepoints with
-* general_category Me, Mn or Cf except U+00AD (SOFT HYPHEN), all
-* codepoints \U+1160 through U+11FF (Hangul Jamo medial vowels and
-* final consonants) -- see
-* https://www.cl.cam.ac.uk/~mgk25/ucs/wcwidth.c from which this is
-* derived;
-* ranges with width==2 represent all codepoints in the East Asian
-* Wide (W) or East Asian Full-width (F) category as defined in the
-* EastAsianWidth.txt file */
-   { 0x0300, 0x036F, 0 }, { 0x0483, 0x0489, 0 }, { 0x0591, 0x05BD, 0 },
-   { 0x05BF, 0x05BF, 0 }, { 0x05C1, 0x05C2, 0 }, { 0x05C4, 0x05C5, 0 },
-   { 0x05C7, 0x05C7, 0 }, { 0x0600, 0x0605, 0 }, { 0x0610, 0x061A, 0 },
-   { 0x061C, 0x061C, 0 }, { 0x064B, 0x065F, 0 }, { 0x0670, 0x0670, 0 },
-   { 0x06D6, 0x06DD, 0 }, { 0x06DF, 0x06E4, 0 }, { 0x06E7, 0x06E8, 0 },
-   { 0x06EA, 0x06ED, 0 }, { 0x070F, 0x070F, 0 }, { 0x0711, 0x0711, 0 },
-   { 0x0730, 0x074A, 0 }, { 0x07A6, 0x07B0, 0 }, { 0x07EB, 0x07F3, 0 },
-   { 0x07FD, 0x07FD, 0 }, { 0x0816, 0x0819, 0 }, { 0x081B, 0x0823, 0 },
-   { 0x0825, 0x0827, 0 }, { 0x0829, 0x082D, 0 }, { 0x0859, 0x085B, 0 },
-   { 0x0890, 0x0891, 0 }, { 0x0898, 0x089F, 0 }, { 0x08CA, 0x0902, 0 },
-   { 0x093A, 0x093A, 0 }, { 0x093C, 0x093C, 0 }, { 0x0941, 0x0948, 0 },
-   { 0x094D, 0x094D, 0 }, { 0x0951, 0x0957, 0 }, { 0x0962, 0x0963, 0 },
-   { 0x0981, 0x0981, 0 }, { 0x09BC, 0x09BC, 0 }, { 0x09C1, 0x09C4, 0 },
-   { 0x09CD, 0x09CD, 0 }, { 0x09E2, 0x09E3, 0 }, { 0x09FE, 0x09FE, 0 },
-   { 0x0A01, 0x0A02, 0 }, { 0x0A3C, 0x0A3C, 0 }, { 0x0A41, 0x0A42, 0 },
-   { 0x0A47, 0x0A48, 0 }, { 0x0A4B, 0x0A4D, 0 }, { 0x0A51, 0x0A51, 0 },
-   { 0x0A70, 0x0A71, 0 }, { 0x0A75, 0x0A75, 0 }, { 0x0A81, 0x0A82, 0 },
-   { 0x0ABC, 0x0ABC, 0 }, { 0x0AC1, 0x0AC5, 0 }, { 0x0AC7, 0x0AC8, 0 },
-   { 0x0ACD, 0x0ACD, 0 }, { 0x0AE2, 0x0AE3, 0 }, { 0x0AFA, 0x0AFF, 0 },
-   { 0x0B01, 0x0B01, 0 }, { 0x0B3C, 0x0B3C, 0 }, { 0x0B3F, 0x0B3F, 0 },
-   { 0x0B41, 0x0B44, 0 }, { 0x0B4D, 0x0B4D, 0 }, { 0x0B55, 0x0B56, 0 },
-   { 0x0B62, 0x0B63, 0 }, { 0x0B82, 0x0B82, 0 }, { 0x0BC0, 0x0BC0, 0 },
-   { 0x0BCD, 0x0BCD, 0 }, { 0x0C00, 0x0C00, 0 }, { 0x0C04, 0x0C04, 0 },
-   { 0x0C3C, 0x0C3C, 0 }, { 0x0C3E, 0x0C40, 0 }, { 0x0C46, 0x0C48, 0 },
-   { 0x0C4A, 0x0C4D, 0 }, { 0x0C55, 0x0C56, 0 }, { 0x0C62, 0x0C63, 0 },
-   { 0x0C81, 0x0C81, 0 }, { 0x0CBC, 0x0CBC, 0 }, { 0x0CBF, 0x0CBF, 0 },
-   { 0x0CC6, 0x0CC6, 0 }, { 0x0CCC, 0x0CCD, 0 }, { 0x0CE2, 0x0CE3, 0 },
-   { 0x0D00, 0x0D01, 0 }, { 0x0D3B, 0x0D3C, 0 }, { 0x0D41, 0x0D44, 0 },
-   { 0x0D4D, 0x0D4D, 0 }, { 0x0D62, 0x0D63, 0 }, { 0x0D81, 0x0D81, 0 },
-   { 0x0DCA, 0x0DCA, 0 }, { 0x0DD2, 0x0DD4, 0 }, { 0x0DD6, 0x0DD6, 0 },
-   { 0x0E31, 0x0E31, 0 }, { 0x0E34, 0x0E3A, 0 }, { 0x0E47, 0x0E4E, 0 },
-   { 0x0EB1, 0x0EB1, 0 }, { 0x0EB4, 0x0EBC, 0 }, { 0x0EC8, 0x0ECE, 0 },
-   { 0x0F18, 0x0F19, 0 }, { 0x0F35, 0x0F35, 0 }, { 0x0F37, 0x0F37, 0 },
-   { 0x0F39, 0x0F39, 0 }, { 0x0F71, 0x0F7E, 0 }, { 0x0F80, 0x0F84, 0 },
-   { 0x0F86, 0x0F87, 0 }, { 0x0F8D, 0x0F97, 0 }, { 0x0F99, 0x0FBC, 0 },
-   { 0x0FC6, 0x0FC6, 0 }, { 0x102D, 0x1030, 0 }, { 0x1032, 0x1037, 0 },
-   { 0x1039, 0x103A, 0 }, { 0x103D, 0x103E, 0 }, { 0x1058, 0x1059, 0 },
-   { 0x105E, 0x1060, 0 }, { 0x1071, 0x1074, 0 }, { 0x1082, 0x1082, 0 },
-   { 0x1085, 0x1086, 0 }, { 0x108D, 0x108D, 0 }, { 0x109D, 0x109D, 0 },
-   { 0x1100, 0x115F, 2 }, { 0x1160, 0x11FF, 0 }, { 0x135D, 0x135F, 0 },
-   { 0x1712, 0x1714, 0 }, { 0x1732, 0x1733, 0 }, { 0x1752, 0x1753, 0 },
-   { 0x1772, 0x1773, 0 }, { 0x17B4, 0x17B5, 0 }, { 0x17B7, 0x17BD, 0 },
- 

MonetDB: default - Layout.

2024-05-29 Thread Sjoerd Mullender via checkin-list
Changeset: 067509d182c9 for MonetDB
URL: https://dev.monetdb.org/hg/MonetDB/rev/067509d182c9
Modified Files:
monetdb5/mal/mal_utils.c
Branch: default
Log Message:

Layout.


diffs (16 lines):

diff --git a/monetdb5/mal/mal_utils.c b/monetdb5/mal/mal_utils.c
--- a/monetdb5/mal/mal_utils.c
+++ b/monetdb5/mal/mal_utils.c
@@ -48,9 +48,9 @@ mal_unquote(char *msg)
   out */
if (p[1] && p[2] && p[1] >= '0' && p[1] <= '7' 
&& p[2] >= '0'
&& p[2] <= '7') {
-   *s = (char) (((p[0] - '0') << 6) | 
((p[1] -
-   
 '0') << 3) | (p[2] -
-   
   '0'));
+   *s = (char) (((p[0] - '0') << 6) |
+((p[1] - '0') 
<< 3) |
+(p[2] - '0'));
p += 2;
break;
}
___
checkin-list mailing list -- checkin-list@monetdb.org
To unsubscribe send an email to checkin-list-le...@monetdb.org


MonetDB: default - Merge with Dec2023 branch.

2024-05-29 Thread Sjoerd Mullender via checkin-list
Changeset: 4784d7f2b200 for MonetDB
URL: https://dev.monetdb.org/hg/MonetDB/rev/4784d7f2b200
Modified Files:
sql/storage/bat/bat_storage.c
sql/storage/objectset.c
sql/storage/store.c
testing/sqllogictest.py
Branch: default
Log Message:

Merge with Dec2023 branch.


diffs (129 lines):

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
@@ -3492,7 +3492,6 @@ log_segments(sql_trans *tr, segments *se
unlock_table(tr->store, id);
if (seg->ts == tr->tid && seg->end-seg->start) {
if (log_segment(tr, seg, id) != LOG_OK) {
-   unlock_table(tr->store, id);
return LOG_ERR;
}
}
diff --git a/sql/storage/objectset.c b/sql/storage/objectset.c
--- a/sql/storage/objectset.c
+++ b/sql/storage/objectset.c
@@ -55,6 +55,7 @@ typedef struct objectset {
allocator *sa;
destroy_fptr destroy;
MT_RWLock rw_lock;  /*readers-writer lock to protect the links 
(chains) in the objectversion chain.*/
+   MT_Lock lock;   /* global objectset lock for os_add/del */
versionhead  *name_based_h;
versionhead  *name_based_t;
versionhead  *id_based_h;
@@ -668,6 +669,7 @@ os_new(allocator *sa, destroy_fptr destr
};
os->destroy = destroy;
MT_rwlock_init(&os->rw_lock, "sa_readers_lock");
+   MT_lock_init(&os->lock, "single_writer_lock");
}
 
return os;
@@ -685,6 +687,7 @@ os_destroy(objectset *os, sql_store stor
 {
if (ATOMIC_DEC(&os->refcnt) > 0)
return;
+   MT_lock_destroy(&os->lock);
MT_rwlock_destroy(&os->rw_lock);
versionhead* n=os->id_based_h;
while(n) {
@@ -927,9 +930,9 @@ os_add_(objectset *os, struct sql_trans 
 int
 os_add(objectset *os, struct sql_trans *tr, const char *name, sql_base *b)
 {
-   store_lock(tr->store);
+   MT_lock_set(&os->lock);
int res = os_add_(os, tr, name, b);
-   store_unlock(tr->store);
+   MT_lock_unset(&os->lock);
return res;
 }
 
@@ -1032,9 +1035,9 @@ os_del_(objectset *os, struct sql_trans 
 int
 os_del(objectset *os, sql_trans *tr, const char *name, sql_base *b)
 {
-   store_lock(tr->store);
+   MT_lock_set(&os->lock);
int res = os_del_(os, tr, name, b);
-   store_unlock(tr->store);
+   MT_lock_unset(&os->lock);
return res;
 }
 
diff --git a/sql/storage/store.c b/sql/storage/store.c
--- a/sql/storage/store.c
+++ b/sql/storage/store.c
@@ -3816,8 +3816,6 @@ sql_trans_destroy(sql_trans *tr)
sql_trans_rollback(tr, false);
sqlstore *store = tr->store;
os_destroy(tr->localtmps, store);
-   store_lock(store);
-   store_unlock(store);
MT_lock_destroy(&tr->lock);
if (!list_empty(tr->dropped))
list_destroy(tr->dropped);
diff --git a/testing/sqllogictest.py b/testing/sqllogictest.py
--- a/testing/sqllogictest.py
+++ b/testing/sqllogictest.py
@@ -656,10 +656,11 @@ class SQLLogic:
 result2 = result
 return result1, result2
 
-def initfile(self, f, defines):
+def initfile(self, f, defines, run_until=None):
 self.name = f
 self.file = open(f, 'r', encoding='utf-8', errors='replace')
 self.line = 0
+self.run_until = run_until
 self.hashes = {}
 defs = []
 if defines:
@@ -674,6 +675,8 @@ class SQLLogic:
 
 def readline(self):
 self.line += 1
+if self.run_until and self.line >= self.run_until:
+return ''
 origline = line = self.file.readline()
 for reg, val, key in self.defines:
 line = reg.sub(val.replace('\\', r'\\'), line)
@@ -736,9 +739,9 @@ class SQLLogic:
 self.raise_error('invalid connection parameters definition, 
username or password missing!')
 return res
 
-def parse(self, f, approve=None, verbose=False, defines=None):
+def parse(self, f, approve=None, verbose=False, defines=None, 
run_until=None):
 self.approve = approve
-self.initfile(f, defines)
+self.initfile(f, defines, run_until=run_until)
 nthreads = None
 if self.language == 'sql':
 self.crs.execute(f'call sys.setsessiontimeout({self.timeout or 
0})')
@@ -945,6 +948,8 @@ if __name__ == '__main__':
 ' (can be repeated)')
 parser.add_argument('--alltests', action='store_true',
 help='also executed "knownfail" tests')
+parser.add_argument('--run-until', action='store', type=int,
+help='run tests until specified line')
 parser.add_argument('tests', nargs='*', help='tests to be run')
 opts = parser.parse_args()
 args = opts.tests
@@ -959,7 +964,7 @@ if __name_

MonetDB: balanced_union - Rewrites mtest query to be readable

2024-05-29 Thread stefanos mavros via checkin-list
Changeset: 3d776f91ae10 for MonetDB
URL: https://dev.monetdb.org/hg/MonetDB/rev/3d776f91ae10
Modified Files:
sql/test/BugDay_2005-10-06_2.9.3/Tests/simple_union.SF-1005596.test
Branch: balanced_union
Log Message:

Rewrites mtest query to be readable


diffs (212 lines):

diff --git 
a/sql/test/BugDay_2005-10-06_2.9.3/Tests/simple_union.SF-1005596.test 
b/sql/test/BugDay_2005-10-06_2.9.3/Tests/simple_union.SF-1005596.test
--- a/sql/test/BugDay_2005-10-06_2.9.3/Tests/simple_union.SF-1005596.test
+++ b/sql/test/BugDay_2005-10-06_2.9.3/Tests/simple_union.SF-1005596.test
@@ -6,79 +6,135 @@ create table test (
 )
 
 query TIIITT rowsort
-SELECT * FROM ( SELECT 'demo' AS "TABLE_CAT",
-"schemas"."name" AS "TABLE_SCHEM", "tables"."name" AS
-"TABLE_NAME", 'SYSTEM TABLE' AS "TABLE_TYPE", '' AS
-"REMARKS", null AS "TYPE_CAT", null AS "TYPE_SCHEM",
-null AS "TYPE_NAME", 'rowid' AS
-"SELF_REFERENCING_COL_NAME", 'SYSTEM' AS
-"REF_GENERATION" FROM "tables", "schemas" WHERE
-"tables"."schema_id" = "schemas"."id" AND
-"tables"."system" = true AND "tables"."type" = 0
-UNION ALL SELECT 'demo' AS "TABLE_CAT",
-"schemas"."name" AS "TABLE_SCHEM", "tables"."name" AS
-"TABLE_NAME", 'TABLE' AS "TABLE_TYPE", '' AS "REMARKS",
-null AS "TYPE_CAT", null AS "TYPE_SCHEM", null AS
-"TYPE_NAME", 'rowid' AS "SELF_REFERENCING_COL_NAME",
-'SYSTEM' AS "REF_GENERATION" FROM "tables", "schemas"
-WHERE "tables"."schema_id" = "schemas"."id" AND
-"tables"."system" = false AND "tables".name = 'test'
-AND "tables"."type" = 0 UNION ALL SELECT 'demo' AS "TABLE_CAT",
-"schemas"."name" AS "TABLE_SCHEM", "tables"."name" AS
-"TABLE_NAME", 'SYSTEM VIEW' AS "TABLE_TYPE", '' AS
-"REMARKS", null AS "TYPE_CAT", null AS "TYPE_SCHEM",
-null AS "TYPE_NAME", 'rowid' AS
-"SELF_REFERENCING_COL_NAME", 'SYSTEM' AS
-"REF_GENERATION" FROM "tables", "schemas" WHERE
-"tables"."schema_id" = "schemas"."id" AND
-"tables"."system" = true AND "tables"."type" = 1
-UNION ALL SELECT 'demo' AS "TABLE_CAT",
-"schemas"."name" AS "TABLE_SCHEM", "tables"."name" AS
-"TABLE_NAME", 'VIEW' AS "TABLE_TYPE", '' AS "REMARKS",
-null AS "TYPE_CAT", null AS "TYPE_SCHEM", null AS
-"TYPE_NAME", 'rowid' AS "SELF_REFERENCING_COL_NAME",
-'SYSTEM' AS "REF_GENERATION" FROM "tables", "schemas"
-WHERE "tables"."schema_id" = "schemas"."id" AND
-"tables"."system" = false AND "tables".name = 'test'
-AND "tables"."type" = 1 UNION ALL SELECT 'demo' AS "TABLE_CAT",
-"schemas"."name" AS "TABLE_SCHEM", "tables"."name" AS
-"TABLE_NAME", 'SYSTEM SESSION TABLE' AS "TABLE_TYPE",
-'' AS "REMARKS", null AS "TYPE_CAT", null AS
-"TYPE_SCHEM", null AS "TYPE_NAME", 'rowid' AS
-"SELF_REFERENCING_COL_NAME", 'SYSTEM' AS
-"REF_GENERATION" FROM tmp."_tables" AS "tables",
-"schemas" WHERE "tables"."schema_id" = "schemas"."id"
-AND "tables"."system" = true AND "tables"."type" =
-0 UNION ALL SELECT 'demo' AS "TABLE_CAT",
-"schemas"."name" AS "TABLE_SCHEM", "tables"."name" AS
-"TABLE_NAME", 'SESSION TABLE' AS "TABLE_TYPE", '' AS
-"REMARKS", null AS "TYPE_CAT", null AS "TYPE_SCHEM",
-null AS "TYPE_NAME", 'rowid' AS
-"SELF_REFERENCING_COL_NAME", 'SYSTEM' AS
-"REF_GENERATION" FROM tmp."_tables" AS "tables",
-"schemas" WHERE "tables"."schema_id" = "schemas"."id"
-AND "tables"."system" = false AND "tables".name = 'test'
-AND "tables"."type" = 0 UNION ALL SELECT 'demo' AS "TABLE_CAT",
-"schemas"."name" AS "TABLE_SCHEM", "tables"."name" AS
-"TABLE_NAME", 'SYSTEM SESSION VIEW' AS "TABLE_TYPE", ''
-AS "REMARKS", null AS "TYPE_CAT", null AS "TYPE_SCHEM",
-null AS "TYPE_NAME", 'rowid' AS
-"SELF_REFERENCING_COL_NAME", 'SYSTEM' AS
-"REF_GENERATION" FROM tmp."_tables" AS "tables",
-"schemas" WHERE "tables"."schema_id" = "schemas"."id"
-AND "tables"."system" = true AND "tables"."type" =
-1 UNION ALL SELECT 'demo' AS "TABLE_CAT",
-"schemas"."name" AS "TABLE_SCHEM", "tables"."name" AS
-"TABLE_NAME", 'SESSION VIEW' AS "TABLE_TYPE", '' AS
-"REMARKS", null AS "TYPE_CAT", null AS "TYPE_SCHEM",
-null AS "TYPE_NAME", 'rowid' AS
-"SELF_REFERENCING_COL_NAME", 'SYSTEM' AS
-"REF_GENERATION" FROM tmp."_tables" AS "tables",
-"schemas" WHERE "tables"."schema_id" = "schemas"."id"
-AND "tables"."system" = false AND "tables".name = 'test'
-AND "tables"."type" = 1 ) AS "tables" WHERE 1 = 1 AND ("TABLE_TYPE" LIKE
-'TABLE' OR "TABLE_TYPE" LIKE 'VIEW') ORDER BY
-"TABLE_TYPE", "TABLE_SCHEM", "TABLE_NAME"
+SELECT * FROM ( 
+SELECT 'demo' AS "TABLE_CAT",
+"schemas"."name" AS "TABLE_SCHEM",
+   "tables"."name" AS "TABLE_NAME",
+   'SYSTEM TABLE' AS "TABLE_TYPE",
+   '' AS "REMARKS",
+   null AS "TYPE_CAT",
+   null AS "TYPE_SCHEM",
+null AS "TYPE_NAME",
+   'rowid' AS "SELF_REFERENCING_COL_NAME",
+   'SYSTEM' AS "REF_GENERATION" 
+   FROM "tables", "schemas" 
+   WHERE "tables"."schema_id" = "schemas"."id" AND
+  "tables"."system" = true AND
+  "tables"."type" = 0
+UNION ALL 
+SELECT 'demo' AS "TABLE_CAT",
+"schemas".

MonetDB: balanced_union - Make sure that op_project doesn't have...

2024-05-29 Thread stefanos mavros via checkin-list
Changeset: 777ea4d09189 for MonetDB
URL: https://dev.monetdb.org/hg/MonetDB/rev/777ea4d09189
Modified Files:
sql/server/rel_statistics.c
Branch: balanced_union
Log Message:

Make sure that op_project doesn't have anything at ->r


diffs (11 lines):

diff --git a/sql/server/rel_statistics.c b/sql/server/rel_statistics.c
--- a/sql/server/rel_statistics.c
+++ b/sql/server/rel_statistics.c
@@ -933,6 +933,7 @@ rel_get_statistics_(visitor *v, sql_rel 
l = rel_select(v->sql->sa, l, 
exp_atom_bool(v->sql->sa, 0));
set_count_prop(v->sql->sa, l, 0);
rel->op = op_project;
+   rel->r = NULL;
rel->l = l;
rel->exps = rel_projections(v->sql, l, NULL, 1, 
1);
set_count_prop(v->sql->sa, rel, 0);
___
checkin-list mailing list -- checkin-list@monetdb.org
To unsubscribe send an email to checkin-list-le...@monetdb.org


MonetDB: default - When breaking off strings, do it after all co...

2024-05-29 Thread Sjoerd Mullender via checkin-list
Changeset: efddfa319de3 for MonetDB
URL: https://dev.monetdb.org/hg/MonetDB/rev/efddfa319de3
Modified Files:
clients/mapiclient/mclient.c
common/utils/mutf8.h
Branch: default
Log Message:

When breaking off strings, do it after all combining characters.


diffs (44 lines):

diff --git a/clients/mapiclient/mclient.c b/clients/mapiclient/mclient.c
--- a/clients/mapiclient/mclient.c
+++ b/clients/mapiclient/mclient.c
@@ -409,7 +409,11 @@ utf8strlenmax(char *s, char *e, size_t m
return len0;
}
if (len == max) {
-   *t = s;
+   /* add any following combining (zero 
width) characters */
+   do {
+   *t = s;
+   s = nextcharn(s, e == NULL ? 4 
: (size_t) (e - s), &codepoint);
+   } while (codepoint > 0 && 
charwidth(codepoint) == 0);
return len;
}
}
diff --git a/common/utils/mutf8.h b/common/utils/mutf8.h
--- a/common/utils/mutf8.h
+++ b/common/utils/mutf8.h
@@ -63,3 +63,24 @@ nextchar(const char *s, uint32_t *c)
*c = 0;
return NULL;
 }
+
+/* like the above, but s is at most n bytes long */
+static inline char *
+nextcharn(const char *s, size_t n, uint32_t *c)
+{
+   uint32_t codepoint = 0, state = 0;
+   while (n-- > 0 && *s) {
+   switch (decode(&state, &codepoint, (uint8_t) *s++)) {
+   case UTF8_ACCEPT:
+   *c = codepoint;
+   return (char *) s;
+   case UTF8_REJECT:
+   *c = 0;
+   return NULL;
+   default:
+   break;
+   }
+   }
+   *c = 0;
+   return NULL;
+}
___
checkin-list mailing list -- checkin-list@monetdb.org
To unsubscribe send an email to checkin-list-le...@monetdb.org


MonetDB: label - approved output

2024-05-29 Thread Niels Nes via checkin-list
Changeset: acb2bfaad31e for MonetDB
URL: https://dev.monetdb.org/hg/MonetDB/rev/acb2bfaad31e
Modified Files:
sql/test/miscellaneous/Tests/simple_selects.test
Branch: label
Log Message:

approved output


diffs (16 lines):

diff --git a/sql/test/miscellaneous/Tests/simple_selects.test 
b/sql/test/miscellaneous/Tests/simple_selects.test
--- a/sql/test/miscellaneous/Tests/simple_selects.test
+++ b/sql/test/miscellaneous/Tests/simple_selects.test
@@ -633,8 +633,11 @@ 3
 4
 5
 
-statement error
+query II rowsort
 select * from (select 1 as c0, max(k) as c0 from (select 2, 3) tst(k, name) 
group by name) as sub
+
+1
+2
 
 query T rowsort
 select cast(interval '3' second as clob)
___
checkin-list mailing list -- checkin-list@monetdb.org
To unsubscribe send an email to checkin-list-le...@monetdb.org


MonetDB: label - merged with default

2024-05-29 Thread Niels Nes via checkin-list
Changeset: e3d40de6fc88 for MonetDB
URL: https://dev.monetdb.org/hg/MonetDB/rev/e3d40de6fc88
Branch: label
Log Message:

merged with default


diffs (truncated from 1386 to 300 lines):

diff --git a/clients/odbc/ChangeLog b/clients/odbc/ChangeLog
--- a/clients/odbc/ChangeLog
+++ b/clients/odbc/ChangeLog
@@ -1,3 +1,24 @@
 # ChangeLog file for odbc
 # This file is updated with Maddlog
 
+* Fri May 24 2024 Joeri van Ruth 
+- ODBC now supports TLS. It can be configured through the following
+  DSN- or Connection String attributes (canonical name / user friendly name):
+TLS / Encrypt = ON/OFF
+CERT / Server Certificate = PATH
+CERTHASH / Server Certificate Hash = sha256:HEXDIGITS
+CLIENTKEY / Client Key = PATH
+CLIENTCERT / Client Certificate = PATH
+AUTOCOMMIT / Autocommit = ON/OFF
+- Several more connection properties have been made configurable:
+SCHEMA / Schema = NAME
+TIMEZONE / Time Zone = Minutes East Of UTC
+REPLYSIZE / Reply Size = NUMBER
+LOGFILE / Log File = PATH
+LOGINTIMEOUT / Login Timeout = MILLISECONDS
+CONNECTIONTIMEOUT / Connection Timeout = MILLISECONDS
+SOCK / Unix Socket = PATH (unix only)
+- SQLBrowseConnect adds On/Off suggestions to boolean settings
+  and prioritizes the DATABASE attribute if it notices monetdbd
+  requires one. Apart from that only UID/User and PWD/Password
+  are required, all others have sensible defaults.
diff --git a/clients/odbc/ChangeLog.odbc-tls b/clients/odbc/ChangeLog.odbc-tls
deleted file mode 100644
--- a/clients/odbc/ChangeLog.odbc-tls
+++ /dev/null
@@ -1,24 +0,0 @@
-# ChangeLog file for odbc
-# This file is updated with Maddlog
-
-* Fri May 24 2024 Joeri van Ruth 
-- ODBC now supports TLS. It can be configured through the following
-  DSN- or Connection String attributes (canonical name / user friendly name):
-TLS / Encrypt = ON/OFF
-CERT / Server Certificate = PATH
-CERTHASH / Server Certificate Hash = sha256:HEXDIGITS
-CLIENTKEY / Client Key = PATH
-CLIENTCERT / Client Certificate = PATH
-AUTOCOMMIT / Autocommit = ON/OFF
-- Several more connection properties have been made configurable:
-SCHEMA / Schema = NAME
-TIMEZONE / Time Zone = Minutes East Of UTC
-REPLYSIZE / Reply Size = NUMBER
-LOGFILE / Log File = PATH
-LOGINTIMEOUT / Login Timeout = MILLISECONDS
-CONNECTIONTIMEOUT / Connection Timeout = MILLISECONDS
-SOCK / Unix Socket = PATH (unix only)
-- SQLBrowseConnect adds On/Off suggestions to boolean settings
-  and prioritizes the DATABASE attribute if it notices monetdbd
-  requires one. Apart from that only UID/User and PWD/Password
-  are required, all others have sensible defaults.
diff --git a/clients/odbc/driver/CMakeLists.txt 
b/clients/odbc/driver/CMakeLists.txt
--- a/clients/odbc/driver/CMakeLists.txt
+++ b/clients/odbc/driver/CMakeLists.txt
@@ -133,6 +133,7 @@ target_link_libraries(MonetODBC
   monetdb_config_header
   mutils
   mapi
+  mutf8
   ${ODBCINST_LIBRARIES})
 
 install(TARGETS
diff --git a/clients/odbc/driver/ODBCUtil.c b/clients/odbc/driver/ODBCUtil.c
--- a/clients/odbc/driver/ODBCUtil.c
+++ b/clients/odbc/driver/ODBCUtil.c
@@ -35,6 +35,7 @@
 #include "ODBCUtil.h"
 #include "ODBCDbc.h"
 #include 
+#include "mutf8.h"
 
 
 #ifdef WIN32
@@ -199,7 +200,6 @@ ODBCutf82wchar(const SQLCHAR *src,
 {
SQLLEN i = 0;
SQLINTEGER j = 0;
-   uint32_t c;
 
if (buf == NULL)
buflen = 0;
@@ -220,51 +220,25 @@ ODBCutf82wchar(const SQLCHAR *src,
else if (length < 0)
return "Invalid length parameter";
 
+   uint32_t state = 0, codepoint = 0;
while (j < length && i + 1 < buflen && src[j]) {
-   if ((src[j+0] & 0x80) == 0) {
-   buf[i++] = src[j+0];
-   j += 1;
-   } else if (j + 1 < length
-  && (src[j+0] & 0xE0) == 0xC0
-  && (src[j+1] & 0xC0) == 0x80
-  && (src[j+0] & 0x1E) != 0) {
-   buf[i++] = (src[j+0] & 0x1F) << 6
-   | (src[j+1] & 0x3F);
-   j += 2;
-   } else if (j + 2 < length
-  && (src[j+0] & 0xF0) == 0xE0
-  && (src[j+1] & 0xC0) == 0x80
-  && (src[j+2] & 0xC0) == 0x80
-  && ((src[j+0] & 0x0F) != 0
-  || (src[j+1] & 0x20) != 0)) {
-   buf[i++] = (src[j+0] & 0x0F) << 12
-   | (src[j+1] & 0x3F) << 6
-   | (src[j+2] & 0x3F);
-   j += 3;
-   } else if (j + 3 < length
-  && (src[j+0] & 0xF8) == 0xF0
-  && (src[j+1] & 0xC0) == 0x80
-  && (src[j+2] & 0xC0) == 0x80
-  && (src[j+3] & 0xC0) == 0x80
-  && ((src[j+0]

MonetDB: label - small fix for finding matching expressions

2024-05-29 Thread Niels Nes via checkin-list
Changeset: a9c8b1c47049 for MonetDB
URL: https://dev.monetdb.org/hg/MonetDB/rev/a9c8b1c47049
Modified Files:
sql/server/rel_exp.c
sql/test/BugTracker-2021/Tests/plan-not-optimal-view.Bug-7140.test
sql/test/astro/Tests/astro.test
sql/test/miscellaneous/Tests/simple_plans.test
Branch: label
Log Message:

small fix for finding matching expressions


diffs (88 lines):

diff --git a/sql/server/rel_exp.c b/sql/server/rel_exp.c
--- a/sql/server/rel_exp.c
+++ b/sql/server/rel_exp.c
@@ -1278,6 +1278,8 @@ exp_match( sql_exp *e1, sql_exp *e2)
if (exp_cmp(e1, e2) == 0)
return 1;
if (e1->type == e2->type && e1->type == e_column) {
+   if (e1->nid && e1->nid == e2->nid)
+   return 1;
if (e1->alias.label != e2->alias.label || !e1->alias.label || 
!e2->alias.label)
return 0;
 #if 0
diff --git a/sql/test/BugTracker-2021/Tests/plan-not-optimal-view.Bug-7140.test 
b/sql/test/BugTracker-2021/Tests/plan-not-optimal-view.Bug-7140.test
--- a/sql/test/BugTracker-2021/Tests/plan-not-optimal-view.Bug-7140.test
+++ b/sql/test/BugTracker-2021/Tests/plan-not-optimal-view.Bug-7140.test
@@ -65,17 +65,17 @@ project (
 | | | | | | | table("sys"."plantest0") [ "plantest0"."id" ]
 | | | | | | ) [ ("plantest0"."id") >= (bigint(28) "15000") ]
 | | | | | ) [ "sys"."sql_div"("plantest0"."id" NOT NULL, int(24) "1000") 
NOT NULL as "t"."id_r" ]
-| | | | ) [ "t"."id_r" NOT NULL ] [ "t"."id_r" NOT NULL, "sys"."count" no nil 
("t"."id_r" NOT NULL) NOT NULL as "%6"."%6" ],
+| | | | ) [ "t"."id_r" NOT NULL ] [ "t"."id_r" NOT NULL, "sys"."count" no nil 
("t"."id_r" NOT NULL) NOT NULL as "%1"."%1" ],
 | | | | group by (
 | | | | | project (
 | | | | | | select (
 | | | | | | | table("sys"."plantest1") [ "plantest1"."id" ]
 | | | | | | ) [ ("plantest1"."id") >= (bigint(28) "15000") ]
 | | | | | ) [ "sys"."sql_div"("plantest1"."id" NOT NULL, int(24) "1000") 
NOT NULL as "t"."id_r" ]
-| | | | ) [ "t"."id_r" NOT NULL ] [ "t"."id_r" NOT NULL, "sys"."count" no nil 
("t"."id_r" NOT NULL) NOT NULL as "%6"."%6" ]
-| | | ) [ "t"."id_r" NOT NULL, "%6"."%6" NOT NULL ]
-| | ) [ "t"."id_r" NOT NULL ] [ "t"."id_r" NOT NULL, "sys"."sum" no nil 
("%6"."%6" NOT NULL) NOT NULL as "%6"."%6" ]
-| ) [ "sys"."sql_mul"("t"."id_r" NOT NULL UNIQUE, int(24) "1000") NOT NULL 
as "id_range_base", "%6"."%6" NOT NULL as "nrows", "t"."id_r" NOT NULL UNIQUE ]
+| | | | ) [ "t"."id_r" NOT NULL ] [ "t"."id_r" NOT NULL, "sys"."count" no nil 
("t"."id_r" NOT NULL) NOT NULL as "%1"."%1" ]
+| | | ) [ "t"."id_r" NOT NULL, "%1"."%1" NOT NULL ]
+| | ) [ "t"."id_r" NOT NULL ] [ "t"."id_r" NOT NULL, "sys"."sum" no nil 
("%1"."%1" NOT NULL) NOT NULL as "%1"."%1" ]
+| ) [ "sys"."sql_mul"("t"."id_r" NOT NULL UNIQUE, int(24) "1000") NOT NULL 
as "id_range_base", "%1"."%1" NOT NULL as "nrows", "t"."id_r" NOT NULL UNIQUE ]
 ) [ "id_range_base" NOT NULL, "nrows" NOT NULL ] [ "t"."id_r" ASC NOT NULL 
UNIQUE ]
 
 query II rowsort
@@ -127,7 +127,7 @@ project (
 | | | | | | | ) [ ("plantest0"."id") >= (bigint(28) "15000") ]
 | | | | | | ) [ "sys"."sql_div"("plantest0"."id" NOT NULL, int(24) "1000") 
NOT NULL as "id_div" ]
 | | | | | ) [ "id_div" NOT NULL as "t"."id_r" ]
-| | | | ) [ "t"."id_r" NOT NULL ] [ "t"."id_r" NOT NULL, "sys"."count" no nil 
("t"."id_r" NOT NULL) NOT NULL as "%6"."%6" ],
+| | | | ) [ "t"."id_r" NOT NULL ] [ "t"."id_r" NOT NULL, "sys"."count" no nil 
("t"."id_r" NOT NULL) NOT NULL as "%1"."%1" ],
 | | | | group by (
 | | | | | project (
 | | | | | | project (
@@ -136,10 +136,10 @@ project (
 | | | | | | | ) [ ("plantest1"."id") >= (bigint(28) "15000") ]
 | | | | | | ) [ "sys"."sql_div"("plantest1"."id" NOT NULL, int(24) "1000") 
NOT NULL as "id_div" ]
 | | | | | ) [ "id_div" NOT NULL as "t"."id_r" ]
-| | | | ) [ "t"."id_r" NOT NULL ] [ "t"."id_r" NOT NULL, "sys"."count" no nil 
("t"."id_r" NOT NULL) NOT NULL as "%6"."%6" ]
-| | | ) [ "t"."id_r" NOT NULL, "%6"."%6" NOT NULL ]
-| | ) [ "t"."id_r" NOT NULL ] [ "t"."id_r" NOT NULL, "sys"."sum" no nil 
("%6"."%6" NOT NULL) NOT NULL as "%6"."%6" ]
-| ) [ "sys"."sql_mul"("t"."id_r" NOT NULL UNIQUE, int(24) "1000") NOT NULL 
as "id_range_base", "%6"."%6" NOT NULL as "nrows", "t"."id_r" NOT NULL UNIQUE ]
+| | | | ) [ "t"."id_r" NOT NULL ] [ "t"."id_r" NOT NULL, "sys"."count" no nil 
("t"."id_r" NOT NULL) NOT NULL as "%1"."%1" ]
+| | | ) [ "t"."id_r" NOT NULL, "%1"."%1" NOT NULL ]
+| | ) [ "t"."id_r" NOT NULL ] [ "t"."id_r" NOT NULL, "sys"."sum" no nil 
("%1"."%1" NOT NULL) NOT NULL as "%1"."%1" ]
+| ) [ "sys"."sql_mul"("t"."id_r" NOT NULL UNIQUE, int(24) "1000") NOT NULL 
as "id_range_base", "%1"."%1" NOT NULL as "nrows", "t"."id_r" NOT NULL UNIQUE ]
 ) [ "id_range_base" NOT NULL, "nrows" NOT NULL ] [ "t"."id_r" ASC NOT NULL 
UNIQUE ]
 
 query II rowsort
diff --git a/sql/test/astro/Tests/astro.test b/sql/test/astro/Tests/astro.test
--- a/sql/test/astro/Tests/astro

MonetDB: balanced_union - Makes sure that inplace set op has ->r...

2024-05-29 Thread stefanos mavros via checkin-list
Changeset: 68caecf084a4 for MonetDB
URL: https://dev.monetdb.org/hg/MonetDB/rev/68caecf084a4
Modified Files:
sql/server/rel_rel.c
Branch: balanced_union
Log Message:

Makes sure that inplace set op has ->r NULL


diffs (11 lines):

diff --git a/sql/server/rel_rel.c b/sql/server/rel_rel.c
--- a/sql/server/rel_rel.c
+++ b/sql/server/rel_rel.c
@@ -557,6 +557,7 @@ rel_inplace_setop_n_ary(mvc *sql, sql_re
rel_inplace_reset_props(rel);
/* rl should be a list of relations */
rel->l = rl;
+   rel->r = NULL;
rel->op = setop;
rel->card = CARD_MULTI;
rel_setop_n_ary_set_exps(sql, rel, exps, false);
___
checkin-list mailing list -- checkin-list@monetdb.org
To unsubscribe send an email to checkin-list-le...@monetdb.org


MonetDB: label - cleanup the code

2024-05-29 Thread Niels Nes via checkin-list
Changeset: 555b7404a2d5 for MonetDB
URL: https://dev.monetdb.org/hg/MonetDB/rev/555b7404a2d5
Modified Files:
sql/server/rel_dump.c
sql/server/rel_exp.c
sql/server/rel_exp.h
sql/server/rel_optimize_others.c
sql/server/rel_optimize_proj.c
sql/server/rel_optimizer.c
sql/server/rel_propagate.c
sql/server/rel_rel.c
sql/server/rel_select.c
sql/server/rel_unnest.c
sql/server/rel_updates.c
Branch: label
Log Message:

cleanup the code


diffs (truncated from 933 to 300 lines):

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
@@ -,7 +,7 @@ exp_read(mvc *sql, sql_rel *lrel, sql_re
if (top_exps) {
exp = exps_bind_column2(top_exps, tname, cname, 
NULL);
if (exp)
-   exp = exp_alias_or_copy(sql, tname, 
cname, lrel, exp);
+   exp = exp_ref(sql, exp);
}
if (!exp && lrel) {
exp = rel_bind_column2(sql, lrel, tname, cname, 
0);
@@ -1565,7 +1565,7 @@ exp_read(mvc *sql, sql_rel *lrel, sql_re
if (top_exps) {
exp = exps_bind_column(top_exps, var_cname, &amb, &mul, 
1);
if (exp)
-   exp = exp_alias_or_copy(sql, exp_relname(exp), 
var_cname, lrel, exp);
+   exp = exp_ref(sql, exp);
}
(void)amb;
(void)mul;
diff --git a/sql/server/rel_exp.c b/sql/server/rel_exp.c
--- a/sql/server/rel_exp.c
+++ b/sql/server/rel_exp.c
@@ -822,31 +822,6 @@ exp_ref_save(mvc *sql, sql_exp *e)
 }
 
 sql_exp *
-exp_alias_nid(mvc *sql, sql_exp *o)
-{
-   sql_exp *e = exp_create(sql->sa, e_column);
-
-   if (e == NULL)
-   return NULL;
-   e->card = o->card;
-   e->alias = o->alias;
-   e->nid = o->nid;
-   assert(e->nid);
-   e->r = (char*)o->r;
-   e->l = (char*)o->l;
-   sql_subtype *t = exp_subtype(o);
-   if (t)
-   e->tpe = *t;
-   if (!has_nil(o))
-   set_has_no_nil(e);
-   if (is_unique(o))
-   set_unique(e);
-   if (is_intern(o))
-   set_intern(e);
-   return exp_propagate(sql->sa, e, o);
-}
-
-sql_exp *
 exp_alias(mvc *sql, const char *arname, const char *acname, const char 
*org_rname, const char *org_cname, sql_subtype *t, unsigned int card, int 
has_nils, int unique, int intern)
 {
sql_exp *e = exp_column(sql->sa, org_rname, org_cname, t, card, 
has_nils, unique, intern);
@@ -858,47 +833,19 @@ exp_alias(mvc *sql, const char *arname, 
return e;
 }
 
-/* add_alias (cname) (or label) (to old) or copy */
-sql_exp *
-exp_alias_or_copy( mvc *sql, const char *tname, const char *cname, sql_rel 
*orel, sql_exp *old)
-{
-   sql_exp *ne = NULL;
-
-   if (!tname)
-   tname = exp_relname(old);
-
-   if (!cname && exp_name(old) && has_label(old)) {
-   ne = exp_column(sql->sa, exp_relname(old), exp_name(old), 
exp_subtype(old), orel && old->card != CARD_ATOM?orel->card:CARD_ATOM, 
has_nil(old), is_unique(old), is_intern(old));
-   ne->nid = old->alias.label;
-   return exp_propagate(sql->sa, ne, old);
-   } else if (!cname) {
-   exp_label(sql->sa, old, ++sql->label);
-   ne = exp_column(sql->sa, exp_relname(old), exp_name(old), 
exp_subtype(old), orel && old->card != CARD_ATOM?orel->card:CARD_ATOM, 
has_nil(old), is_unique(old), is_intern(old));
-   ne->nid = old->alias.label;
-   return exp_propagate(sql->sa, ne, old);
-   } else if (cname && !old->alias.name) {
-   exp_setname(sql, old, tname, cname);
-   }
-   ne = exp_column(sql->sa, tname, cname, exp_subtype(old), orel && 
old->card != CARD_ATOM?orel->card:CARD_ATOM, has_nil(old), is_unique(old), 
is_intern(old));
-   ne->nid = old->alias.label;
-   if ((tname && exp_relname(old) && strcmp(tname, exp_relname(old)) == 0) 
|| (!tname && !exp_relname(old)))
-   if (cname && exp_name(old) && strcmp(cname, exp_name(old)) == 0)
-   ne->alias.label = ne->nid;
-   return exp_propagate(sql->sa, ne, old);
-}
-
 sql_exp *
 exp_alias_ref(mvc *sql, sql_exp *e)
 {
-   sql_exp *ne = NULL;
const char *tname = exp_relname(e);
const char *cname = exp_name(e);
 
if (!has_label(e))
exp_label(sql->sa, e, ++sql->label);
-   ne = exp_ref(sql, e);
+   sql_exp *ne = exp_ref(sql, e);
+   if (ne == NULL)
+   return NULL;
exp_setname(sql, ne, tname, cname);
-   return exp_propagate(sql->sa, ne, e);
+   return ne;
 }
 
 sql_exp *
@@ -1282,12 +1229,6 @@ exp_match( sql_exp *e1, sql_ex

MonetDB: label - approve small changes

2024-05-29 Thread Niels Nes via checkin-list
Changeset: 834dc89e8cb8 for MonetDB
URL: https://dev.monetdb.org/hg/MonetDB/rev/834dc89e8cb8
Modified Files:
sql/test/BugTracker-2021/Tests/plan-not-optimal-view.Bug-7140.test
sql/test/BugTracker-2022/Tests/dependencies.Bug-7328.test
sql/test/rel-optimizers/Tests/groupjoin.test
Branch: label
Log Message:

approve small changes


diffs (49 lines):

diff --git a/sql/test/BugTracker-2021/Tests/plan-not-optimal-view.Bug-7140.test 
b/sql/test/BugTracker-2021/Tests/plan-not-optimal-view.Bug-7140.test
--- a/sql/test/BugTracker-2021/Tests/plan-not-optimal-view.Bug-7140.test
+++ b/sql/test/BugTracker-2021/Tests/plan-not-optimal-view.Bug-7140.test
@@ -125,7 +125,7 @@ project (
 | | | | | | | select (
 | | | | | | | | table("sys"."plantest0") [ "plantest0"."id" ]
 | | | | | | | ) [ ("plantest0"."id") >= (bigint(28) "15000") ]
-| | | | | | ) [ "sys"."sql_div"("plantest0"."id" NOT NULL, int(24) "1000") 
NOT NULL as "id_div" ]
+| | | | | | ) [ "plantest0"."id" NOT NULL as "v"."id", 
"sys"."sql_div"("plantest0"."id" NOT NULL, int(24) "1000") NOT NULL as 
"id_div" ]
 | | | | | ) [ "id_div" NOT NULL as "t"."id_r" ]
 | | | | ) [ "t"."id_r" NOT NULL ] [ "t"."id_r" NOT NULL, "sys"."count" no nil 
("t"."id_r" NOT NULL) NOT NULL as "%1"."%1" ],
 | | | | group by (
@@ -134,7 +134,7 @@ project (
 | | | | | | | select (
 | | | | | | | | table("sys"."plantest1") [ "plantest1"."id" ]
 | | | | | | | ) [ ("plantest1"."id") >= (bigint(28) "15000") ]
-| | | | | | ) [ "sys"."sql_div"("plantest1"."id" NOT NULL, int(24) "1000") 
NOT NULL as "id_div" ]
+| | | | | | ) [ "plantest1"."id" NOT NULL as "v"."id", 
"sys"."sql_div"("plantest1"."id" NOT NULL, int(24) "1000") NOT NULL as 
"id_div" ]
 | | | | | ) [ "id_div" NOT NULL as "t"."id_r" ]
 | | | | ) [ "t"."id_r" NOT NULL ] [ "t"."id_r" NOT NULL, "sys"."count" no nil 
("t"."id_r" NOT NULL) NOT NULL as "%1"."%1" ]
 | | | ) [ "t"."id_r" NOT NULL, "%1"."%1" NOT NULL ]
diff --git a/sql/test/BugTracker-2022/Tests/dependencies.Bug-7328.test 
b/sql/test/BugTracker-2022/Tests/dependencies.Bug-7328.test
--- a/sql/test/BugTracker-2022/Tests/dependencies.Bug-7328.test
+++ b/sql/test/BugTracker-2022/Tests/dependencies.Bug-7328.test
@@ -123,6 +123,10 @@ FROM sys.dependency_columns_on_functions
 WHERE function_name LIKE 'mmtest04'
 ORDER BY name
 
+id
+mmtest04
+1
+7
 name
 mmtest04
 1
diff --git a/sql/test/rel-optimizers/Tests/groupjoin.test 
b/sql/test/rel-optimizers/Tests/groupjoin.test
--- a/sql/test/rel-optimizers/Tests/groupjoin.test
+++ b/sql/test/rel-optimizers/Tests/groupjoin.test
@@ -13,7 +13,7 @@ project (
 | | table("sys"."integers") [ "integers"."i" as "i1"."i" ],
 | | project (
 | | | table("sys"."integers") [ "integers"."i" ]
-| | ) [ "integers"."i" as "%4"."%4" ]
-| ) [ ("i1"."i") + = ("%4"."%4") ] [ boolean(1) "true" as "%5"."%5" ]
-) [ "i1"."i", "sys"."or"("%5"."%5", "sys"."isnull"("i1"."i") NOT NULL) ]
+| | ) [ "integers"."i" as "%1"."%1", "%1"."%1" as "integers"."i" ]
+| ) [ ("i1"."i") + = ("%1"."%1"), ("i1"."i") = ("%1"."%1") ] [ boolean(1) 
"true" as "%4"."%4" ]
+) [ "i1"."i", "sys"."or"("%4"."%4", "sys"."isnull"("i1"."i") NOT NULL) ]
 
___
checkin-list mailing list -- checkin-list@monetdb.org
To unsubscribe send an email to checkin-list-le...@monetdb.org


MonetDB: default - fixed issue #7524

2024-05-29 Thread Niels Nes via checkin-list
Changeset: d3a2c0438f99 for MonetDB
URL: https://dev.monetdb.org/hg/MonetDB/rev/d3a2c0438f99
Added Files:
sql/test/BugTracker-2024/Tests/7524-right-outer-join.test
Modified Files:
sql/server/rel_select.c
sql/test/BugTracker-2024/Tests/All
Branch: default
Log Message:

fixed issue #7524


diffs (79 lines):

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
@@ -5556,7 +5556,7 @@ static sql_rel *
 join_on_column_name(sql_query *query, sql_rel *rel, sql_rel *t1, sql_rel *t2, 
int op, int l_nil, int r_nil)
 {
mvc *sql = query->sql;
-   int found = 0, full = (op != op_join);
+   int found = 0, full = (op == op_full), right = (op == op_right);
list *exps = rel_projections(sql, t1, NULL, 1, 0);
list *r_exps = rel_projections(sql, t2, NULL, 1, 0);
list *outexps = new_exp_list(sql->sa);
@@ -5580,18 +5580,22 @@ join_on_column_name(sql_query *query, sq
found = 1;
if (!(rel = rel_compare_exp(query, rel, le, re, "=", 
TRUE, 0, 0, 0, 0)))
return NULL;
+   list_remove_data(r_exps, NULL, re);
if (full) {
sql_exp *cond = rel_unop_(sql, rel, le, "sys", 
"isnull", card_value);
if (!cond)
return NULL;
set_has_no_nil(cond);
+   if (rel_convert_types(sql, NULL, NULL, &le, 
&re, 1, type_equal_no_any) < 0)
+   return NULL;
if (!(le = rel_nop_(sql, rel, cond, re, le, 
NULL, "sys", "ifthenelse", card_value)))
return NULL;
+   } else if (right) {
+   le = re;
}
exp_setname(sql->sa, le, rname, name);
set_not_unique(le);
append(outexps, le);
-   list_remove_data(r_exps, NULL, re);
} else {
if (l_nil)
set_has_nil(le);
diff --git a/sql/test/BugTracker-2024/Tests/7524-right-outer-join.test 
b/sql/test/BugTracker-2024/Tests/7524-right-outer-join.test
new file mode 100644
--- /dev/null
+++ b/sql/test/BugTracker-2024/Tests/7524-right-outer-join.test
@@ -0,0 +1,30 @@
+
+statement ok
+CREATE TABLE t0(c0 INT)
+
+statement ok
+CREATE TABLE t1(c0 VARCHAR)
+
+query II
+SELECT * FROM t1 LEFT JOIN t0 ON t1.c0 = t0.c0
+
+
+query II
+SELECT * FROM t1 RIGHT JOIN t0 ON t1.c0 = t0.c0
+
+
+query II
+SELECT * FROM t1 FULL JOIN t0 ON t1.c0 = t0.c0
+
+
+query I
+SELECT * FROM t1 NATURAL LEFT JOIN t0
+
+
+query I
+SELECT * FROM t1 NATURAL RIGHT JOIN t0
+
+
+query I
+SELECT * FROM t1 NATURAL FULL JOIN t0
+
diff --git a/sql/test/BugTracker-2024/Tests/All 
b/sql/test/BugTracker-2024/Tests/All
--- a/sql/test/BugTracker-2024/Tests/All
+++ b/sql/test/BugTracker-2024/Tests/All
@@ -59,3 +59,4 @@ 7511-password-hash-missing-error
 7512-concurrent-globaltmp-instantiate-crash
 7513-uri-authority-parse-issue
 7514-wrong-window-function
+7524-right-outer-join
___
checkin-list mailing list -- checkin-list@monetdb.org
To unsubscribe send an email to checkin-list-le...@monetdb.org


MonetDB: label - more clean up

2024-05-29 Thread Niels Nes via checkin-list
Changeset: c96fd5fd3241 for MonetDB
URL: https://dev.monetdb.org/hg/MonetDB/rev/c96fd5fd3241
Modified Files:
sql/server/rel_exp.c
sql/server/rel_exp.h
sql/server/rel_unnest.c
Branch: label
Log Message:

more clean up


diffs (59 lines):

diff --git a/sql/server/rel_exp.c b/sql/server/rel_exp.c
--- a/sql/server/rel_exp.c
+++ b/sql/server/rel_exp.c
@@ -1264,23 +1264,6 @@ exps_find_exp( list *l, sql_exp *e)
return NULL;
 }
 
-sql_exp*
-exps_find_equal_exp( list *l, sql_exp *e)
-{
-   node *n;
-
-   if (!l || !l->h)
-   return NULL;
-
-   for(n=l->h; n; n = n->next) {
-   sql_exp *s = n->data;
-   if (exp_match(n->data, e) || (s->nid && s->nid == e->nid))
-   return n->data;
-   }
-   return NULL;
-}
-
-
 /* c refers to the parent p */
 int
 exp_refers( sql_exp *p, sql_exp *c)
diff --git a/sql/server/rel_exp.h b/sql/server/rel_exp.h
--- a/sql/server/rel_exp.h
+++ b/sql/server/rel_exp.h
@@ -147,7 +147,6 @@ extern int exp_refers( sql_exp *p, sql_e
 extern sql_exp *exps_refers( sql_exp *p, list *exps);
 extern int exp_match( sql_exp *e1, sql_exp *e2);
 extern sql_exp* exps_find_exp( list *l, sql_exp *e);
-extern sql_exp* exps_find_equal_exp( list *l, sql_exp *e);
 extern int exp_match_exp( sql_exp *e1, sql_exp *e2);
 extern int exp_match_exp_semantics( sql_exp *e1, sql_exp *e2, bool semantics);
 extern sql_exp* exps_any_match(list *l, sql_exp *e);
diff --git a/sql/server/rel_unnest.c b/sql/server/rel_unnest.c
--- a/sql/server/rel_unnest.c
+++ b/sql/server/rel_unnest.c
@@ -3793,7 +3793,7 @@ rewrite_groupings(visitor *v, sql_rel *r
 
for (node *nn = groups->h ; nn 
; nn = nn->next) {
sql_exp *exp = 
(sql_exp*) nn->data;
-   if 
(!exps_find_equal_exp(l, exp)) {
+   if (!exps_find_exp(l, 
exp)) {
switch 
(ATOMstorage(a->data.vtype)) {
case 
TYPE_bte:

a->data.val.btval += (bte) (1 << counter);
@@ -3822,7 +3822,7 @@ rewrite_groupings(visitor *v, sql_rel *r
ne = exp_atom(v->sql->sa, a);
if (exp_name(e))

exp_prop_alias(v->sql->sa, ne, e);
-   } else if (e->type == e_column && 
!exps_find_equal_exp(l, e) && !has_label(e)) {
+   } else if (e->type == e_column && 
!exps_find_exp(l, e) && !has_label(e)) {
/* do not include in the output 
of the group by, but add to the project as null */
ne = exp_atom(v->sql->sa, 
atom_general(v->sql->sa, exp_subtype(e), NULL, 0));
if (exp_name(e))
___
checkin-list mailing list -- checkin-list@monetdb.org
To unsubscribe send an email to checkin-list-le...@monetdb.org


MonetDB: label - merged with default

2024-05-29 Thread Niels Nes via checkin-list
Changeset: cf540fc6d1e6 for MonetDB
URL: https://dev.monetdb.org/hg/MonetDB/rev/cf540fc6d1e6
Modified Files:
sql/server/rel_select.c
Branch: label
Log Message:

merged with default


diffs (123 lines):

diff --git a/clients/mapiclient/mclient.c b/clients/mapiclient/mclient.c
--- a/clients/mapiclient/mclient.c
+++ b/clients/mapiclient/mclient.c
@@ -409,7 +409,11 @@ utf8strlenmax(char *s, char *e, size_t m
return len0;
}
if (len == max) {
-   *t = s;
+   /* add any following combining (zero 
width) characters */
+   do {
+   *t = s;
+   s = nextcharn(s, e == NULL ? 4 
: (size_t) (e - s), &codepoint);
+   } while (codepoint > 0 && 
charwidth(codepoint) == 0);
return len;
}
}
diff --git a/common/utils/mutf8.h b/common/utils/mutf8.h
--- a/common/utils/mutf8.h
+++ b/common/utils/mutf8.h
@@ -63,3 +63,24 @@ nextchar(const char *s, uint32_t *c)
*c = 0;
return NULL;
 }
+
+/* like the above, but s is at most n bytes long */
+static inline char *
+nextcharn(const char *s, size_t n, uint32_t *c)
+{
+   uint32_t codepoint = 0, state = 0;
+   while (n-- > 0 && *s) {
+   switch (decode(&state, &codepoint, (uint8_t) *s++)) {
+   case UTF8_ACCEPT:
+   *c = codepoint;
+   return (char *) s;
+   case UTF8_REJECT:
+   *c = 0;
+   return NULL;
+   default:
+   break;
+   }
+   }
+   *c = 0;
+   return NULL;
+}
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
@@ -5580,7 +5580,7 @@ static sql_rel *
 join_on_column_name(sql_query *query, sql_rel *rel, sql_rel *t1, sql_rel *t2, 
int op, int l_nil, int r_nil)
 {
mvc *sql = query->sql;
-   int found = 0, full = (op != op_join);
+   int found = 0, full = (op == op_full), right = (op == op_right);
list *exps = rel_projections(sql, t1, NULL, 1, 0);
list *r_exps = rel_projections(sql, t2, NULL, 1, 0);
list *outexps = new_exp_list(sql->sa);
@@ -5604,18 +5604,22 @@ join_on_column_name(sql_query *query, sq
found = 1;
if (!(rel = rel_compare_exp(query, rel, le, re, "=", 
TRUE, 0, 0, 0, 0)))
return NULL;
+   list_remove_data(r_exps, NULL, re);
if (full) {
sql_exp *cond = rel_unop_(sql, rel, le, "sys", 
"isnull", card_value);
if (!cond)
return NULL;
set_has_no_nil(cond);
+   if (rel_convert_types(sql, NULL, NULL, &le, 
&re, 1, type_equal_no_any) < 0)
+   return NULL;
if (!(le = rel_nop_(sql, rel, cond, re, le, 
NULL, "sys", "ifthenelse", card_value)))
return NULL;
+   } else if (right) {
+   le = re;
}
exp_setname(sql, le, rname, name);
set_not_unique(le);
append(outexps, le);
-   list_remove_data(r_exps, NULL, re);
} else {
if (l_nil)
set_has_nil(le);
diff --git a/sql/test/BugTracker-2024/Tests/7524-right-outer-join.test 
b/sql/test/BugTracker-2024/Tests/7524-right-outer-join.test
new file mode 100644
--- /dev/null
+++ b/sql/test/BugTracker-2024/Tests/7524-right-outer-join.test
@@ -0,0 +1,30 @@
+
+statement ok
+CREATE TABLE t0(c0 INT)
+
+statement ok
+CREATE TABLE t1(c0 VARCHAR)
+
+query II
+SELECT * FROM t1 LEFT JOIN t0 ON t1.c0 = t0.c0
+
+
+query II
+SELECT * FROM t1 RIGHT JOIN t0 ON t1.c0 = t0.c0
+
+
+query II
+SELECT * FROM t1 FULL JOIN t0 ON t1.c0 = t0.c0
+
+
+query I
+SELECT * FROM t1 NATURAL LEFT JOIN t0
+
+
+query I
+SELECT * FROM t1 NATURAL RIGHT JOIN t0
+
+
+query I
+SELECT * FROM t1 NATURAL FULL JOIN t0
+
diff --git a/sql/test/BugTracker-2024/Tests/All 
b/sql/test/BugTracker-2024/Tests/All
--- a/sql/test/BugTracker-2024/Tests/All
+++ b/sql/test/BugTracker-2024/Tests/All
@@ -59,3 +59,4 @@ 7511-password-hash-missing-error
 7512-concurrent-globaltmp-instantiate-crash
 7513-uri-authority-parse-issue
 7514-wrong-window-function
+7524-right-outer-join
___
checkin-li

MonetDB: label - Add casts.

2024-05-29 Thread Sjoerd Mullender via checkin-list
Changeset: 830142d4a906 for MonetDB
URL: https://dev.monetdb.org/hg/MonetDB/rev/830142d4a906
Modified Files:
sql/server/rel_select.c
sql/server/rel_updates.c
Branch: label
Log Message:

Add casts.


diffs (33 lines):

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
@@ -779,7 +779,7 @@ rel_named_table_function(sql_query *quer
for (m = sf->func->res->h; m; m = m->next) {
sql_arg *a = m->data;
sql_exp *e = exp_column(sql->sa, tname, a->name, 
&a->type, CARD_MULTI, 1, 0, 0);
-   e->alias.label = -(sql->nid++);
+   e->alias.label = -(int)(sql->nid++);
 
set_basecol(e);
append(exps, e);
diff --git a/sql/server/rel_updates.c b/sql/server/rel_updates.c
--- a/sql/server/rel_updates.c
+++ b/sql/server/rel_updates.c
@@ -1562,7 +1562,7 @@ rel_import(mvc *sql, sql_table *t, const
if (c->base.name[0] != '%') {
sql_exp *e = exp_column(sql->sa, t->base.name, 
c->base.name, &c->type, CARD_MULTI, c->null, is_column_unique(c), 0);
 
-   e->alias.label = -(sql->nid++);
+   e->alias.label = -(int) (sql->nid++);
append(exps, e);
}
}
@@ -1850,7 +1850,7 @@ bincopyfrom(sql_query *query, dlist *qna
for (n = collist->h; n; n = n->next) {
sql_column *c = n->data;
sql_exp *e = exp_column(sql->sa, t->base.name, c->base.name, 
&c->type, CARD_MULTI, c->null, is_column_unique(c), 0);
-   e->alias.label = -(sql->nid++);
+   e->alias.label = -(int) (sql->nid++);
append(exps, e);
}
res = rel_table_func(sql->sa, NULL, import, exps, TABLE_PROD_FUNC);
___
checkin-list mailing list -- checkin-list@monetdb.org
To unsubscribe send an email to checkin-list-le...@monetdb.org


MonetDB: balanced_union - Adjusts prepare-complex expected output

2024-05-29 Thread stefanos mavros via checkin-list
Changeset: 4c56469adc77 for MonetDB
URL: https://dev.monetdb.org/hg/MonetDB/rev/4c56469adc77
Modified Files:
sql/test/prepare/Tests/prepare-complex.stable.out
Branch: balanced_union
Log Message:

Adjusts prepare-complex expected output


diffs (19 lines):

diff --git a/sql/test/prepare/Tests/prepare-complex.stable.out 
b/sql/test/prepare/Tests/prepare-complex.stable.out
--- a/sql/test/prepare/Tests/prepare-complex.stable.out
+++ b/sql/test/prepare/Tests/prepare-complex.stable.out
@@ -17,11 +17,11 @@ stdout of test 'prepare-complex` in dire
 % type,digits, scale,  schema, table,  column # name
 % varchar, int,int,varchar,varchar,varchar # type
 % 7,   2,  1,  0,  3,  3 # length
-[ "decimal",   2,  1,  "", "%22",  "%13"   ]
-[ "int",   32, 0,  "", "%22",  "c2"]
+[ "decimal",   2,  1,  "", "%20",  "%12"   ]
+[ "int",   32, 0,  "", "%20",  "c2"]
 [ "decimal",   2,  1,  NULL,   NULL,   NULL]
-[ "int",   32, 0,  NULL,   NULL,   NULL]
-[ "int",   32, 0,  NULL,   NULL,   NULL]
+[ "int",   31, 0,  NULL,   NULL,   NULL]
+[ "int",   31, 0,  NULL,   NULL,   NULL]
 [ "boolean",   1,  0,  NULL,   NULL,   NULL]
 #ROLLBACK;
 
___
checkin-list mailing list -- checkin-list@monetdb.org
To unsubscribe send an email to checkin-list-le...@monetdb.org


MonetDB: balanced_union - Adjusts emptydb check output (labels c...

2024-05-29 Thread stefanos mavros via checkin-list
Changeset: ccc9fc310534 for MonetDB
URL: https://dev.monetdb.org/hg/MonetDB/rev/ccc9fc310534
Modified Files:
sql/test/emptydb/Tests/check.stable.out.int128
Branch: balanced_union
Log Message:

Adjusts emptydb check output (labels changes and alias propagation)


diffs (truncated from 639 to 300 lines):

diff --git a/sql/test/emptydb/Tests/check.stable.out.int128 
b/sql/test/emptydb/Tests/check.stable.out.int128
--- a/sql/test/emptydb/Tests/check.stable.out.int128
+++ b/sql/test/emptydb/Tests/check.stable.out.int128
@@ -5195,8 +5195,8 @@ select 'null in fkeys.delete_action', de
 % %1,  name,   name,   start,  minvalue,   maxvalue,   increment,  
cacheinc,   cycle,  comment # name
 % varchar, varchar,varchar,bigint, bigint, bigint, bigint, 
bigint, boolean,varchar # type
 % 0,   0,  0,  1,  1,  1,  1,  1,  5,  0 # 
length
-% .%17 # table_name
-% %17 # name
+% .%16 # table_name
+% %16 # name
 % bigint # type
 % 1 # length
 [ 0]
@@ -5676,16 +5676,16 @@ select 'null in fkeys.delete_action', de
 % %2,  %1, id # name
 % varchar, bigint, int # type
 % 0,   1,  1 # length
-% .%11,sys.%7, sys.tables # table_name
-% %11, %7, id # name
+% .%7, sys.%6, sys.tables # table_name
+% %7,  %6, id # name
 % varchar, bigint, int # type
 % 0,   1,  1 # length
 % .%2, sys.%1, sys._columns # table_name
 % %2,  %1, id # name
 % varchar, bigint, int # type
 % 0,   1,  1 # length
-% .%10,sys.%6, sys.columns # table_name
-% %10, %6, id # name
+% .%6, sys.%5, sys.columns # table_name
+% %6,  %5, id # name
 % varchar, bigint, int # type
 % 0,   1,  1 # length
 % .%2, sys.%1, sys.functions # table_name
@@ -5768,8 +5768,8 @@ select 'null in fkeys.delete_action', de
 % %2,  %1, name # name
 % varchar, bigint, varchar # type
 % 0,   1,  0 # length
-% .%23,.%17,   .statistics # table_name
-% %23, %17,column_id # name
+% .%22,.%16,   .statistics # table_name
+% %22, %16,column_id # name
 % varchar, bigint, int # type
 % 0,   1,  1 # length
 % .%3, .%2,.%1,.%1,.%1 # table_name
@@ -5816,12 +5816,12 @@ select 'null in fkeys.delete_action', de
 % %2,  %1, id # name
 % varchar, bigint, int # type
 % 0,   1,  1 # length
-% .%175,   .%167,  .ids # table_name
-% %175,%167,   id # name
+% .%150,   .%147,  .ids # table_name
+% %150,%147,   id # name
 % varchar, bigint, int # type
 % 0,   1,  1 # length
-% .%105,   .%104,  .var_values # table_name
-% %105,%104,   var_name # name
+% .%75,.%74,   .var_values # table_name
+% %75, %74,var_name # name
 % varchar, bigint, varchar # type
 % 0,   1,  0 # length
 % .%2, sys.%1, sys.table_partitions # table_name
@@ -5848,8 +5848,8 @@ select 'null in fkeys.delete_action', de
 % %2,  %1, action_id # name
 % varchar, bigint, smallint # type
 % 0,   1,  1 # length
-% .%13,.%12,   .fkeys # table_name
-% %13, %12,id # name
+% .%12,.%11,   .fkeys # table_name
+% %12, %11,id # name
 % varchar, bigint, int # type
 % 0,   1,  1 # length
 % .%2, sys.%1, sys.schemas # table_name
@@ -5860,32 +5860,32 @@ select 'null in fkeys.delete_action', de
 % %2,  %1, schema_id,  name # name
 % varchar, bigint, int,varchar # type
 % 0,   1,  1,  0 # length
-% .%11,sys.%7, sys.tables, sys.tables # table_name
-% %11, %7, schema_id,  name # name
+% .%7, sys.%6, sys.tables, sys.tables # table_name
+% %7,  %6, schema_id,  name # name
 % varchar, bigint, int,varchar # type
 % 0,   1,  1,  0 # length
 % .%2, sys.%1, sys._columns,   sys._columns # table_name
 % %2,  %1, table_id,   name # name
 % varchar, bigint, int,varchar # type
 % 0,   1,  1,  0 # length
-% .%10,sys.%6, sys.columns,sys.columns # table_name
-% %10, %6, table_id,   name # name
+% .%6, sys.%5, sys.columns,sys.columns # table_name
+% %6,  %5, table_id,   name # name
 % varchar, bigint, int,varchar # type
 % 0,   1,  1,  0 # length
 % .%2, sys.%1, sys._columns,   sys._columns # table_name
 % %2,  %1, table_id,   number # name
 % varchar, bigint, int,int # type
 % 0,   1,  1,  1 # length
-% .%10,sys.%6, sys.columns,sys.columns # table_name
-% %10, %6, table_id,   number # name
+% .%6, sys.%5, sys.columns,sys.columns # table_name
+% %6,  %5, table_id,   number # name
 % varchar, bigint, int,int # type
 % 0,   1,  1,  1 # length
-% .%21,.%20,   .t # table_name
-% %21, %20,id # name
+% .%16,.%15,   .t # table_name
+% %16, %15,id # name
 % varchar, bigint, int # type
 % 0,   1,  1 # length
-% .%36,.%33,   .t # table_name
-% %36, %33,id # name
+% .%27,.%26,   .t # table_name
+% %27, %26,id

MonetDB: balanced_union - Fixes munion stats for case of subrel ...

2024-05-29 Thread stefanos mavros via checkin-list
Changeset: b9858dd60394 for MonetDB
URL: https://dev.monetdb.org/hg/MonetDB/rev/b9858dd60394
Modified Files:
sql/server/rel_statistics.c
Branch: balanced_union
Log Message:

Fixes munion stats for case of subrel without PROP_COUNT


diffs (20 lines):

diff --git a/sql/server/rel_statistics.c b/sql/server/rel_statistics.c
--- a/sql/server/rel_statistics.c
+++ b/sql/server/rel_statistics.c
@@ -882,9 +882,15 @@ rel_get_statistics_(visitor *v, sql_rel 
/* we need new munion statistics */
/* propagate row count */
BUN rv = need_distinct(rel) ? rel_calc_nuniques(v->sql, 
r, r->exps) : get_rel_count(r);
+   /* if PROP_COUNT does not exist we assume at least a 
row (see get_rel_count def) */
+   if (rv == BUN_NONE) {
+   cnt++;
+   continue;
+   }
if (!rv && can_be_pruned)
needs_pruning = true;
-   if (rv > (BUN_MAX - cnt)) /* overflow check */
+   /* overflow check */
+   if (rv > (BUN_MAX - cnt))
rv = BUN_MAX;
else
cnt += rv;
___
checkin-list mailing list -- checkin-list@monetdb.org
To unsubscribe send an email to checkin-list-le...@monetdb.org


MonetDB: clientinfo - Extend the sessions table with new columns

2024-05-29 Thread Joeri van Ruth via checkin-list
Changeset: 83dba6c65e41 for MonetDB
URL: https://dev.monetdb.org/hg/MonetDB/rev/83dba6c65e41
Modified Files:
monetdb5/modules/mal/clients.c
sql/backends/monet5/sql.c
sql/scripts/22_clients.sql
Branch: clientinfo
Log Message:

Extend the sessions table with new columns

Seven new columns: language, peer, hostname, application, client, clientpid and 
remark


diffs (176 lines):

diff --git a/monetdb5/modules/mal/clients.c b/monetdb5/modules/mal/clients.c
--- a/monetdb5/modules/mal/clients.c
+++ b/monetdb5/modules/mal/clients.c
@@ -779,6 +779,7 @@ CLTsessions(Client cntxt, MalBlkPtr mb, 
BAT *id = NULL, *user = NULL, *login = NULL, *sessiontimeout = NULL,
*querytimeout = NULL, *idle = NULL;
BAT *opt = NULL, *wlimit = NULL, *mlimit = NULL;
+   BAT *language = NULL, *peer = NULL, *hostname = NULL, *application = 
NULL, *client = NULL, *clientpid = NULL, *remark = NULL;
bat *idId = getArgReference_bat(stk, pci, 0);
bat *userId = getArgReference_bat(stk, pci, 1);
bat *loginId = getArgReference_bat(stk, pci, 2);
@@ -788,6 +789,13 @@ CLTsessions(Client cntxt, MalBlkPtr mb, 
bat *querytimeoutId = getArgReference_bat(stk, pci, 6);
bat *wlimitId = getArgReference_bat(stk, pci, 7);
bat *mlimitId = getArgReference_bat(stk, pci, 8);
+   bat *languageId = getArgReference_bat(stk, pci, 9);
+   bat *peerId = getArgReference_bat(stk, pci, 10);
+   bat *hostnameId = getArgReference_bat(stk, pci, 11);
+   bat *applicationId = getArgReference_bat(stk, pci, 12);
+   bat *clientId = getArgReference_bat(stk, pci, 13);
+   bat *clientpidId = getArgReference_bat(stk, pci, 14);
+   bat *remarkId = getArgReference_bat(stk, pci, 15);
Client c;
timestamp ret;
int timeout;
@@ -805,20 +813,36 @@ CLTsessions(Client cntxt, MalBlkPtr mb, 
wlimit = COLnew(0, TYPE_int, 0, TRANSIENT);
mlimit = COLnew(0, TYPE_int, 0, TRANSIENT);
idle = COLnew(0, TYPE_timestamp, 0, TRANSIENT);
+   language = COLnew(0, TYPE_str, 0, TRANSIENT);
+   peer = COLnew(0, TYPE_str, 0, TRANSIENT);
+   hostname = COLnew(0, TYPE_str, 0, TRANSIENT);
+   application = COLnew(0, TYPE_str, 0, TRANSIENT);
+   client = COLnew(0, TYPE_str, 0, TRANSIENT);
+   clientpid = COLnew(0, TYPE_lng, 0, TRANSIENT);
+   remark = COLnew(0, TYPE_str, 0, TRANSIENT);
 
if (id == NULL || user == NULL || login == NULL || sessiontimeout == 
NULL
|| idle == NULL || querytimeout == NULL || opt == NULL || 
wlimit == NULL
-   || mlimit == NULL) {
+   || mlimit == NULL || language == NULL || peer == NULL || 
hostname == NULL
+   || application == NULL || client == NULL || clientpid == NULL
+   || remark == NULL) {
BBPreclaim(id);
BBPreclaim(user);
BBPreclaim(login);
BBPreclaim(sessiontimeout);
BBPreclaim(querytimeout);
BBPreclaim(idle);
-
BBPreclaim(opt);
BBPreclaim(wlimit);
BBPreclaim(mlimit);
+   BBPreclaim(language);
+   BBPreclaim(peer);
+   BBPreclaim(hostname);
+   BBPreclaim(application);
+   BBPreclaim(client);
+   BBPreclaim(clientpid);
+   BBPreclaim(remark);
+
throw(SQL, "sql.sessions", SQLSTATE(HY013) MAL_MALLOC_FAIL);
}
 
@@ -866,6 +890,20 @@ CLTsessions(Client cntxt, MalBlkPtr mb, 
goto bailout;
if (BUNappend(mlimit, &c->memorylimit, false) != 
GDK_SUCCEED)
goto bailout;
+   if (BUNappend(language, &str_nil, false) != GDK_SUCCEED)
+   goto bailout;
+   if (BUNappend(peer, &str_nil, false) != GDK_SUCCEED)
+   goto bailout;
+   if (BUNappend(hostname, &str_nil, false) != GDK_SUCCEED)
+   goto bailout;
+   if (BUNappend(application, &str_nil, false) != 
GDK_SUCCEED)
+   goto bailout;
+   if (BUNappend(client, &str_nil, false) != GDK_SUCCEED)
+   goto bailout;
+   if (BUNappend(clientpid, &lng_nil, false) != 
GDK_SUCCEED)
+   goto bailout;
+   if (BUNappend(remark, &str_nil, false) != GDK_SUCCEED)
+   goto bailout;
}
}
MT_lock_unset(&mal_contextLock);
@@ -888,6 +926,21 @@ CLTsessions(Client cntxt, MalBlkPtr mb, 
BBPkeepref(wlimit);
*mlimitId = mlimit->batCacheid;
BBPkeepref(mlimit);
+   *languageId = language->batCacheid;
+   BBPkeepref(language);
+   *peerId = peer->batCacheid;
+   

MonetDB: clientinfo - Attempt at sql_upgrades code

2024-05-29 Thread Joeri van Ruth via checkin-list
Changeset: b692cbf8e44d for MonetDB
URL: https://dev.monetdb.org/hg/MonetDB/rev/b692cbf8e44d
Modified Files:
sql/backends/monet5/sql_upgrades.c
Branch: clientinfo
Log Message:

Attempt at sql_upgrades code


diffs (57 lines):

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
@@ -7096,6 +7096,53 @@ sql_update_default(Client c, mvc *sql, s
sa_destroy(sql->sa);
}
sql->sa = old_sa;
+   if (err)
+   return err;
+
+   const char *query = "select id from args where func_id = (select id 
from functions where schema_id = 2000 and name = 'sessions');\n";
+   err = SQLstatementIntern(c, query, "update", true, false, &output);
+   if (err)
+   return err;
+   b = BATdescriptor(output->cols[0].b);
+   if (b && BATcount(b) < 15) {
+   query =
+   "drop view sys.sessions;\n"
+   "drop function sys.sessions();\n"
+   "create function sys.sessions()\n"
+   " returns table(\n"
+   "  \"sessionid\" int,\n"
+   "  \"username\" string,\n"
+   "  \"login\" timestamp,\n"
+   "  \"idle\" timestamp,\n"
+   "  \"optimizer\" string,\n"
+   "  \"sessiontimeout\" int,\n"
+   "  \"querytimeout\" int,\n"
+   "  \"workerlimit\" int,\n"
+   "  \"memorylimit\" int,\n"
+   "  \"language\" string,\n"
+   "  \"peer\" string,\n"
+   "  \"hostname\" string,\n"
+   "  \"application\" string,\n"
+   "  \"client\" string,\n"
+   "  \"clientpid\" bigint,\n"
+   "  \"remark\" string\n"
+   " )\n"
+   " external name sql.sessions;\n"
+   "create view sys.sessions as select * from 
sys.sessions();\n"
+   ;
+   sql_schema *sys = mvc_bind_schema(sql, "sys");
+   sql_table *t = mvc_bind_table(sql, sys, "sessions");
+   t->system = 0; /* make it non-system else the drop view will 
fail */
+   printf("Running database upgrade commands:\n%s\n", query);
+   fflush(stdout);
+   err = SQLstatementIntern(c, query, "update", true, false, NULL);
+   if (!err) {
+   t = mvc_bind_table(sql, sys, "sessions");
+   t->system = true;
+
+   }
+   }
+   BBPunfix(b->batCacheid);
return err;
 }
 
___
checkin-list mailing list -- checkin-list@monetdb.org
To unsubscribe send an email to checkin-list-le...@monetdb.org


MonetDB: clientinfo - Fill sys.sessions.language using getScenar...

2024-05-29 Thread Joeri van Ruth via checkin-list
Changeset: 5230f28cd265 for MonetDB
URL: https://dev.monetdb.org/hg/MonetDB/rev/5230f28cd265
Modified Files:
monetdb5/modules/mal/clients.c
Branch: clientinfo
Log Message:

Fill sys.sessions.language using getScenarioLanguage()


diffs (12 lines):

diff --git a/monetdb5/modules/mal/clients.c b/monetdb5/modules/mal/clients.c
--- a/monetdb5/modules/mal/clients.c
+++ b/monetdb5/modules/mal/clients.c
@@ -890,7 +890,7 @@ CLTsessions(Client cntxt, MalBlkPtr mb, 
goto bailout;
if (BUNappend(mlimit, &c->memorylimit, false) != 
GDK_SUCCEED)
goto bailout;
-   if (BUNappend(language, &str_nil, false) != GDK_SUCCEED)
+   if (BUNappend(language, getScenarioLanguage(c), false) 
!= GDK_SUCCEED)
goto bailout;
if (BUNappend(peer, &str_nil, false) != GDK_SUCCEED)
goto bailout;
___
checkin-list mailing list -- checkin-list@monetdb.org
To unsubscribe send an email to checkin-list-le...@monetdb.org


MonetDB: clientinfo - Create Client fields to hold new session info

2024-05-29 Thread Joeri van Ruth via checkin-list
Changeset: fbda8398b9e5 for MonetDB
URL: https://dev.monetdb.org/hg/MonetDB/rev/fbda8398b9e5
Modified Files:
monetdb5/mal/mal_client.c
monetdb5/mal/mal_client.h
monetdb5/mal/mal_session.c
monetdb5/mal/mal_session.h
monetdb5/modules/mal/clients.c
monetdb5/modules/mal/mal_mapi.c
Branch: clientinfo
Log Message:

Create Client fields to hold new session info


diffs (235 lines):

diff --git a/monetdb5/mal/mal_client.c b/monetdb5/mal/mal_client.c
--- a/monetdb5/mal/mal_client.c
+++ b/monetdb5/mal/mal_client.c
@@ -401,6 +401,27 @@ MCcloseClient(Client c)
GDKfree(c->username);
c->username = 0;
}
+   if (c->peer) {
+   GDKfree(c->peer);
+   c->peer = 0;
+   }
+   if (c->client_hostname) {
+   GDKfree(c->client_hostname);
+   c->client_hostname = 0;
+   }
+   if (c->client_application) {
+   GDKfree(c->client_application);
+   c->client_application = 0;
+   }
+   if (c->client_library) {
+   GDKfree(c->client_library);
+   c->client_library = 0;
+   }
+   if (c->client_remark) {
+   GDKfree(c->client_remark);
+   c->client_remark = 0;
+   }
+   c->client_pid = 0;
c->mythread = NULL;
if (c->glb) {
freeStack(c->glb);
diff --git a/monetdb5/mal/mal_client.h b/monetdb5/mal/mal_client.h
--- a/monetdb5/mal/mal_client.h
+++ b/monetdb5/mal/mal_client.h
@@ -85,6 +85,12 @@ typedef struct CLIENT {
time_t login;   /* Time when this session 
started */
lng session;/* usec since start of server */
time_t idle;/* Time when the session became 
idle */
+   str peer;   /* Remote end of 
network connection */
+   str client_hostname;/* Host name if reported by client, 
peer otherwise */
+   str client_application; /* Application name reported by the 
client*/
+   str client_library; /* MAPI client library reported 
by the client */
+   long client_pid;/* client process id reported 
by the client */
+   str client_remark;  /* Other 
information reported by the client */
 
/*
 * For program debugging and performance trace we keep the actual 
resource claims.
diff --git a/monetdb5/mal/mal_session.c b/monetdb5/mal/mal_session.c
--- a/monetdb5/mal/mal_session.c
+++ b/monetdb5/mal/mal_session.c
@@ -186,7 +186,7 @@ cleanUpScheduleClient(Client c, str *com
 
 
 void
-MSscheduleClient(str command, str challenge, bstream *fin, stream *fout,
+MSscheduleClient(str command, str peer, str challenge, bstream *fin, stream 
*fout,
 protocol_version protocol, size_t blocksize)
 {
char *user = command, *algo = NULL, *passwd = NULL, *lang = NULL,
@@ -341,6 +341,10 @@ MSscheduleClient(str command, str challe
 
// at this point username should have being verified
c->username = GDKstrdup(user);
+   if (peer) {
+   c->peer = GDKstrdup(peer);
+   c->client_hostname = GDKstrdup(peer);
+   }
 
/* NOTE ABOUT STARTING NEW THREADS
 * At this point we have conducted experiments (Jun 2012) with
diff --git a/monetdb5/mal/mal_session.h b/monetdb5/mal/mal_session.h
--- a/monetdb5/mal/mal_session.h
+++ b/monetdb5/mal/mal_session.h
@@ -19,7 +19,7 @@
 mal_export str malBootstrap(char *modules[], bool embedded,
const char *initpasswd);
 mal_export str MSinitClientPrg(Client cntxt, const char *mod, const char *nme);
-mal_export void MSscheduleClient(str command, str challenge, bstream *fin,
+mal_export void MSscheduleClient(str command, str peer, str challenge, bstream 
*fin,
 stream *fout, 
protocol_version protocol,
 size_t 
blocksize);
 
diff --git a/monetdb5/modules/mal/clients.c b/monetdb5/modules/mal/clients.c
--- a/monetdb5/modules/mal/clients.c
+++ b/monetdb5/modules/mal/clients.c
@@ -797,7 +797,9 @@ CLTsessions(Client cntxt, MalBlkPtr mb, 
bat *clientpidId = getArgReference_bat(stk, pci, 14);
bat *remarkId = getArgReference_bat(stk, pci, 15);
Client c;
-   timestamp ret;
+   timestamp ts;
+   lng pid;
+   const char *s;
int timeout;
str msg = NULL;
 
@@ -855,8 +857,8 @@ CLTsessions(Client cntxt, MalBlkPtr mb, 
username = str_nil;
if (BUNappend(user, username, false) != GDK_SUCCEED)
goto bailout;
-   ret = timestamp_fromtime(c->login);
-   if (is_tim

MonetDB: clientinfo - Include portnr in 'peer', and do not copy ...

2024-05-29 Thread Joeri van Ruth via checkin-list
Changeset: 670d7d0c5057 for MonetDB
URL: https://dev.monetdb.org/hg/MonetDB/rev/670d7d0c5057
Modified Files:
monetdb5/mal/mal_session.c
monetdb5/modules/mal/mal_mapi.c
Branch: clientinfo
Log Message:

Include portnr in 'peer', and do not copy it to client_hostname


diffs (63 lines):

diff --git a/monetdb5/mal/mal_session.c b/monetdb5/mal/mal_session.c
--- a/monetdb5/mal/mal_session.c
+++ b/monetdb5/mal/mal_session.c
@@ -341,10 +341,8 @@ MSscheduleClient(str command, str peer, 
 
// at this point username should have being verified
c->username = GDKstrdup(user);
-   if (peer) {
+   if (peer)
c->peer = GDKstrdup(peer);
-   c->client_hostname = GDKstrdup(peer);
-   }
 
/* NOTE ABOUT STARTING NEW THREADS
 * At this point we have conducted experiments (Jun 2012) with
diff --git a/monetdb5/modules/mal/mal_mapi.c b/monetdb5/modules/mal/mal_mapi.c
--- a/monetdb5/modules/mal/mal_mapi.c
+++ b/monetdb5/modules/mal/mal_mapi.c
@@ -172,7 +172,8 @@ doChallenge(void *data)
 {
struct challengedata *chdata = data;
char *buf = GDKmalloc(BLOCK + 1);
-   char peer[120] = { 0 };
+   char peerbuf[120] = { '[', 0 };
+   char *peer;
char challenge[13];
 
stream *fdin = chdata->in;
@@ -182,11 +183,30 @@ doChallenge(void *data)
protocol_version protocol = PROTOCOL_9;
size_t buflen = BLOCK;
 
-   if (chdata->peer.ss_family != AF_UNSPEC) {
-   getnameinfo(
+   if (chdata->peer.ss_family == AF_UNSPEC) {
+   peer = NULL;
+#ifdef AF_UNIX
+   } else if (chdata->peer.ss_family == AF_UNIX) {
+   peer = "";
+#endif
+   } else {
+   char *peer_end = peerbuf + sizeof(peerbuf);
+   char *p = &peerbuf[1];
+   char service[20];
+   if (0 == getnameinfo(
(struct sockaddr*)&chdata->peer, 
chdata->peerlen,
-   peer, sizeof(peer), NULL, 0,
-   NI_NUMERICSERV | NI_NUMERICHOST);
+   p, peer_end - p - 10,
+   service, sizeof(service),
+   NI_NUMERICSERV | NI_NUMERICHOST)
+   ) {
+   p += strlen(p);
+   *p++ = ']';
+   *p++ = ':';
+   strncpy(p, service, peer_end - p);
+   peer = peerbuf;
+   } else {
+   peer = NULL;
+   }
}
 
MT_thread_setworking("challenging client");
___
checkin-list mailing list -- checkin-list@monetdb.org
To unsubscribe send an email to checkin-list-le...@monetdb.org


MonetDB: clientinfo - Unwrap mel signature lines

2024-05-29 Thread Joeri van Ruth via checkin-list
Changeset: ca8ad1e3b92a for MonetDB
URL: https://dev.monetdb.org/hg/MonetDB/rev/ca8ad1e3b92a
Modified Files:
sql/backends/monet5/sql.c
Branch: clientinfo
Log Message:

Unwrap mel signature lines


diffs (40 lines):

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
@@ -5330,33 +5330,9 @@ static mel_func sql_init_funcs[] = {
  pattern("sql", "argRecord", SQLargRecord, false, "Glue together the calling 
sequence", args(1,1, arg("",str))),
  pattern("sql", "argRecord", SQLargRecord, false, "Glue together the calling 
sequence", args(1,2, arg("",str),varargany("a",0))),
  pattern("sql", "sql_variables", sql_variables, false, "return the table with 
session variables", args(4,4, 
batarg("sname",str),batarg("name",str),batarg("type",str),batarg("value",str))),
-
-
-
-
- pattern("sql", "sessions", sql_sessions_wrap, false, "SQL export table of 
active sessions, their timeouts and idle status",
-   args(16,16,
- batarg("id",int),batarg("user",str),batarg("start",timestamp),
-batarg("idle",timestamp),batarg("optmizer",str),batarg("stimeout",int),
-batarg("qtimeout",int),batarg("wlimit",int),batarg("mlimit",int),
-   batarg("language", str),
-   batarg("peer", str),
-   batarg("hostname", str),
-   batarg("application", str),
-   batarg("client", str),
-   batarg("clientpid", lng),
-   batarg("remark", str),
-  )
- ),
-
-
-
-
-
-
-
-pattern("sql", "password", SQLuser_password, false, "Return password hash of 
user", args(1,2, arg("",str),arg("user",str))),
-pattern("sql", "decypher", SQLdecypher, false, "Return decyphered password", 
args(1,2, arg("",str),arg("hash",str))),
+ pattern("sql", "sessions", sql_sessions_wrap, false, "SQL export table of 
active sessions, their timeouts and idle 
status",args(16,16,batarg("id",int),batarg("user",str),batarg("start",timestamp),batarg("idle",timestamp),batarg("optmizer",str),batarg("stimeout",int),batarg("qtimeout",int),batarg("wlimit",int),batarg("mlimit",int),batarg("language",
 str),batarg("peer", str),batarg("hostname", str),batarg("application", 
str),batarg("client", str),batarg("clientpid", lng),batarg("remark", str),)),
+ pattern("sql", "password", SQLuser_password, false, "Return password hash of 
user", args(1,2, arg("",str),arg("user",str))),
+ pattern("sql", "decypher", SQLdecypher, false, "Return decyphered password", 
args(1,2, arg("",str),arg("hash",str))),
  pattern("sql", "dump_cache", dump_cache, false, "dump the content of the 
query cache", args(2,2, batarg("query",str),batarg("count",int))),
  pattern("sql", "dump_opt_stats", dump_opt_stats, false, "dump the optimizer 
rewrite statistics", args(2,2, batarg("rewrite",str),batarg("count",int))),
  pattern("sql", "dump_trace", dump_trace, false, "dump the trace statistics", 
args(3,3, batarg("ticks",lng),batarg("stmt",str),batarg("stmt",str))),
___
checkin-list mailing list -- checkin-list@monetdb.org
To unsubscribe send an email to checkin-list-le...@monetdb.org


MonetDB: clientinfo - Approve exports

2024-05-29 Thread Joeri van Ruth via checkin-list
Changeset: 61e7be02ebd0 for MonetDB
URL: https://dev.monetdb.org/hg/MonetDB/rev/61e7be02ebd0
Modified Files:
clients/Tests/exports.stable.out
Branch: clientinfo
Log Message:

Approve exports


diffs (20 lines):

diff --git a/clients/Tests/exports.stable.out b/clients/Tests/exports.stable.out
--- a/clients/Tests/exports.stable.out
+++ b/clients/Tests/exports.stable.out
@@ -810,6 +810,7 @@ void MCcloseClient(Client c);
 Client MCgetClient(int id);
 Client MCinitClient(oid user, bstream *fin, stream *fout);
 int MCpushClientInput(Client c, bstream *new_input, int listing, const char 
*prompt);
+void MCsetClientInfo(Client c, const char *property, const char *value);
 void MCstopClients(Client c);
 str MCsuspendClient(int id);
 int MCvalid(Client c);
@@ -818,7 +819,7 @@ str MSinitClientPrg(Client cntxt, const 
 void MSresetInstructions(MalBlkPtr mb, int start);
 void MSresetStack(Client cntxt, MalBlkPtr mb, MalStkPtr glb);
 void MSresetVariables(MalBlkPtr mb);
-void MSscheduleClient(str command, str challenge, bstream *fin, stream *fout, 
protocol_version protocol, size_t blocksize);
+void MSscheduleClient(str command, str peer, str challenge, bstream *fin, 
stream *fout, protocol_version protocol, size_t blocksize);
 str OIDXcreateImplementation(Client cntxt, int tpe, BAT *b, int pieces);
 str OIDXdropImplementation(Client cntxt, BAT *b);
 str QLOGcalls(BAT **r);
___
checkin-list mailing list -- checkin-list@monetdb.org
To unsubscribe send an email to checkin-list-le...@monetdb.org


MonetDB: clientinfo - Add sys.setclientinfo(property string, val...

2024-05-29 Thread Joeri van Ruth via checkin-list
Changeset: d73a1a6b3d41 for MonetDB
URL: https://dev.monetdb.org/hg/MonetDB/rev/d73a1a6b3d41
Modified Files:
monetdb5/mal/mal_client.c
monetdb5/mal/mal_client.h
monetdb5/modules/mal/clients.c
sql/backends/monet5/sql_upgrades.c
sql/scripts/22_clients.sql
Branch: clientinfo
Log Message:

Add sys.setclientinfo(property string, value string)


diffs (127 lines):

diff --git a/monetdb5/mal/mal_client.c b/monetdb5/mal/mal_client.c
--- a/monetdb5/mal/mal_client.c
+++ b/monetdb5/mal/mal_client.c
@@ -642,3 +642,56 @@ MCprintinfo(void)
printf("%d active clients, %d finishing clients, %d blocked clients\n",
   nrun, nfinish, nblock);
 }
+
+
+void
+MCsetClientInfo(Client c, const char *property, const char *value)
+{
+   if (strlen(property) < 7)
+   return;
+
+   // 012345 6 78...
+   // Client H ostname
+   // Applic a tionName
+   // Client L ibrary
+   // Client R emark
+   // Client P id
+   int discriminant = toupper(property[6]);
+
+   switch (discriminant) {
+   case 'H':
+   if (strcasecmp(property, "ClientHostname") == 0) {
+   GDKfree(c->client_hostname);
+   c->client_hostname = GDKstrdup(value);
+   }
+   break;
+   case 'A':
+   if (strcasecmp(property, "ApplicationName") == 0) {
+   GDKfree(c->client_application);
+   c->client_application = GDKstrdup(value);
+   }
+   break;
+   case 'L':
+   if (strcasecmp(property, "ClientLibrary") == 0) {
+   GDKfree(c->client_library);
+   c->client_library = GDKstrdup(value);
+   }
+   break;
+   case 'R':
+   if (strcasecmp(property, "ClientRemark") == 0) {
+   GDKfree(c->client_remark);
+   c->client_remark = GDKstrdup(value);
+   }
+   break;
+   case 'P':
+   if (strcasecmp(property, "ClientPid") == 0) {
+   char *end;
+   long n = strtol(value, &end, 10);
+   if (*value && !*end)
+   c->client_pid = n;
+   }
+   break;
+   default:
+   break;
+   }
+}
diff --git a/monetdb5/mal/mal_client.h b/monetdb5/mal/mal_client.h
--- a/monetdb5/mal/mal_client.h
+++ b/monetdb5/mal/mal_client.h
@@ -195,5 +195,6 @@ mal_export str MCawakeClient(int id);
 mal_export int MCpushClientInput(Client c, bstream *new_input, int listing,
 const char 
*prompt);
 mal_export int MCvalid(Client c);
+mal_export void MCsetClientInfo(Client c, const char *property, const char 
*value);
 
 #endif /* _MAL_CLIENT_H_ */
diff --git a/monetdb5/modules/mal/clients.c b/monetdb5/modules/mal/clients.c
--- a/monetdb5/modules/mal/clients.c
+++ b/monetdb5/modules/mal/clients.c
@@ -983,6 +983,17 @@ CLTgetSessionID(Client cntxt, MalBlkPtr 
return MAL_SUCCEED;
 }
 
+static str
+CLTsetClientInfo(Client cntxt, MalBlkPtr mb, MalStkPtr stk, InstrPtr pci)
+{
+   (void)mb;
+   str property = *getArgReference_str(stk, pci, 1);
+   str value = *getArgReference_str(stk, pci, 2);
+
+   MCsetClientInfo(cntxt, property, value);
+   return MAL_SUCCEED;
+}
+
 #include "mel.h"
 mel_func clients_init_funcs[] = {
  pattern("clients", "setListing", CLTsetListing, true, "Turn on/off echo of 
MAL instructions:\n1 - echo input,\n2 - show mal instruction,\n4 - show details 
of type resolutoin, \n8 - show binding information.", args(1,2, 
arg("",int),arg("flag",int))),
@@ -1021,6 +1032,7 @@ mel_func clients_init_funcs[] = {
  pattern("clients", "getPasswordHash", CLTgetPasswordHash, false, "Return the 
password hash of the given user", args(1,2, arg("",str),arg("user",str))),
  pattern("clients", "checkPermission", CLTcheckPermission, false, "Check 
permission for a user, requires hashed password (backendsum)", args(1,3, 
arg("",void),arg("usr",str),arg("pw",str))),
  pattern("clients", "current_sessionid", CLTgetSessionID, false, "return 
current session ID", args(1,1, arg("",int))),
+ pattern("clients", "setinfo", CLTsetClientInfo, true, "set a clientinfo 
property", args(1, 3, arg("",str), arg("property", str), arg("value", str))),
  { .imp=NULL }
 };
 #include "mal_import.h"
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
@@ -7129,6 +7129,10 @@ sql_update_default(Client c, mvc *sql,

MonetDB: clientinfo - Fix memory leak in upgrade code

2024-05-29 Thread Joeri van Ruth via checkin-list
Changeset: 8e379470485c for MonetDB
URL: https://dev.monetdb.org/hg/MonetDB/rev/8e379470485c
Modified Files:
sql/backends/monet5/sql_upgrades.c
Branch: clientinfo
Log Message:

Fix memory leak in upgrade code


diffs (119 lines):

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
@@ -6645,13 +6645,19 @@ sql_update_dec2023_sp4(Client c, mvc *sq
 static str
 sql_update_default(Client c, mvc *sql, sql_schema *s)
 {
+   allocator *old_sa = sql->sa;
char *err;
res_table *output;
BAT *b;
 
+   if ((sql->sa = sa_create(sql->pa)) == NULL) {
+   sql->sa = old_sa;
+   return "sa_create failed";
+   }
+
err = SQLstatementIntern(c, "SELECT id FROM sys.functions WHERE 
schema_id = 2000 AND name = 'describe_type' AND func LIKE '%sql_datatype%';\n", 
"update", true, false, &output);
if (err)
-   return err;
+   goto end;
b = BATdescriptor(output->cols[0].b);
if (b) {
if (BATcount(b) == 0) {
@@ -7068,41 +7074,36 @@ sql_update_default(Client c, mvc *sql, s
BBPunfix(b->batCacheid);
}
res_table_destroy(output);
-   allocator *old_sa = sql->sa;
-   if ((sql->sa = sa_create(sql->pa)) != NULL) {
-   list *l;
-   if ((l = sa_list(sql->sa)) != NULL) {
-   sql_subtype tp1, tp2;
-   sql_find_subtype(&tp1, "date", 0, 0);
-   list_append(l, &tp1);
-   list_append(l, &tp1);
-   sql_find_subtype(&tp2, "day_interval", 0, 0);
-   list_append(l, &tp2);
-   if (!sql_bind_func_(sql, s->base.name, 
"generate_series", l, F_UNION, true, true)) {
-   const char query[] = "create function 
sys.generate_series(first date, \"limit\" date, stepsize interval month)\n"
-   "returns table (value date)\n"
-   "external name generator.series;\n"
-   "create function 
sys.generate_series(first date, \"limit\" date, stepsize interval day)\n"
-   "returns table (value date)\n"
-   "external name generator.series;\n"
-   "update sys.functions set system = true 
where system <> true and name = 'generate_series' and schema_id = 2000;\n";
-   sql->session->status = 0;
-   sql->errstr[0] = '\0';
-   printf("Running database upgrade 
commands:\n%s\n", query);
-   fflush(stdout);
-   err = SQLstatementIntern(c, query, "update", 
true, false, NULL);
-   }
+   list *l;
+   if ((l = sa_list(sql->sa)) != NULL) {
+   sql_subtype tp1, tp2;
+   sql_find_subtype(&tp1, "date", 0, 0);
+   list_append(l, &tp1);
+   list_append(l, &tp1);
+   sql_find_subtype(&tp2, "day_interval", 0, 0);
+   list_append(l, &tp2);
+   if (!sql_bind_func_(sql, s->base.name, "generate_series", l, 
F_UNION, true, true)) {
+   const char query[] = "create function 
sys.generate_series(first date, \"limit\" date, stepsize interval month)\n"
+   "returns table (value date)\n"
+   "external name generator.series;\n"
+   "create function sys.generate_series(first 
date, \"limit\" date, stepsize interval day)\n"
+   "returns table (value date)\n"
+   "external name generator.series;\n"
+   "update sys.functions set system = true where 
system <> true and name = 'generate_series' and schema_id = 2000;\n";
+   sql->session->status = 0;
+   sql->errstr[0] = '\0';
+   printf("Running database upgrade commands:\n%s\n", 
query);
+   fflush(stdout);
+   err = SQLstatementIntern(c, query, "update", true, 
false, NULL);
}
-   sa_destroy(sql->sa);
}
-   sql->sa = old_sa;
if (err)
-   return err;
+   goto end;
 
const char *query = "select id from args where func_id = (select id 
from functions where schema_id = 2000 and name = 'sessions');\n";
err = SQLstatementIntern(c, query, "update", true, false, &output);
if (err)
-   return err;
+   goto end;
b = BATdescriptor(output->cols[0].b);
if (b && BATcount(b) < 15) {
query =
@@ -7132,7 +7133,7 

MonetDB: clientinfo - Add a system table that lists the supporte...

2024-05-29 Thread Joeri van Ruth via checkin-list
Changeset: e76a2b4354ce for MonetDB
URL: https://dev.monetdb.org/hg/MonetDB/rev/e76a2b4354ce
Modified Files:
sql/backends/monet5/sql_upgrades.c
sql/scripts/22_clients.sql
Branch: clientinfo
Log Message:

Add a system table that lists the supported client info properties


diffs (37 lines):

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
@@ -7133,7 +7133,15 @@ sql_update_default(Client c, mvc *sql, s
"create procedure sys.setclientinfo(property string, 
value string)\n"
" external name clients.setinfo;\n"
"grant execute on procedure sys.setclientinfo(string, 
string) to public;\n"
-   "update sys.functions set system = true where schema_id 
= 2000 and name in ('setclientinfo', 'sessions');";
+   "create table sys.clientinfo_properties(prop string);\n"
+   "insert into sys.clientinfo_properties values\n"
+   " ('ClientHostname'),\n"
+   " ('ApplicationName'),\n"
+   " ('ClientLibrary'),\n"
+   " ('ClientRemark'),\n"
+   " ('ClientPid');\n"
+   "update sys.functions set system = true where schema_id 
= 2000 and name in ('setclientinfo', 'sessions');\n"
+   "update sys._tables set system = true where schema_id = 
2000 and name = 'clientinfo_properties';\n";
;
sql_schema *sys = mvc_bind_schema(sql, "sys");
sql_table *t = mvc_bind_table(sql, sys, "sessions");
diff --git a/sql/scripts/22_clients.sql b/sql/scripts/22_clients.sql
--- a/sql/scripts/22_clients.sql
+++ b/sql/scripts/22_clients.sql
@@ -44,6 +44,13 @@ create view sys.sessions as select * fro
 create procedure sys.setclientinfo(property string, value string)
external name clients.setinfo;
 grant execute on procedure sys.setclientinfo(string, string) to public;
+create table sys.clientinfo_properties(prop string);
+insert into sys.clientinfo_properties values
+   ('ClientHostname'),
+   ('ApplicationName'),
+   ('ClientLibrary'),
+   ('ClientRemark'),
+   ('ClientPid');
 
 -- routines to bring the system down quickly
 create procedure sys.shutdown(delay tinyint)
___
checkin-list mailing list -- checkin-list@monetdb.org
To unsubscribe send an email to checkin-list-le...@monetdb.org


MonetDB: clientinfo - Approve more tests

2024-05-29 Thread Joeri van Ruth via checkin-list
Changeset: 0b8847b09df7 for MonetDB
URL: https://dev.monetdb.org/hg/MonetDB/rev/0b8847b09df7
Modified Files:
sql/test/emptydb/Tests/check.stable.out
sql/test/sys-schema/Tests/check_ForeignKey_referential_integrity.test
Branch: clientinfo
Log Message:

Approve more tests


diffs (47 lines):

diff --git a/sql/test/emptydb/Tests/check.stable.out 
b/sql/test/emptydb/Tests/check.stable.out
--- a/sql/test/emptydb/Tests/check.stable.out
+++ b/sql/test/emptydb/Tests/check.stable.out
@@ -1502,6 +1502,13 @@ select 'null in fkeys.delete_action', de
 [ "sys._columns",  "sys",  "sessions", "querytimeout", "int",  31, 
0,  NULL,   true,   6,  NULL,   NULL]
 [ "sys._columns",  "sys",  "sessions", "workerlimit",  "int",  31, 
0,  NULL,   true,   7,  NULL,   NULL]
 [ "sys._columns",  "sys",  "sessions", "memorylimit",  "int",  31, 
0,  NULL,   true,   8,  NULL,   NULL]
+[ "sys._columns",  "sys",  "sessions", "language", "varchar",  
0,  0,  NULL,   true,   9,  NULL,   NULL]
+[ "sys._columns",  "sys",  "sessions", "peer", "varchar",  0,  
0,  NULL,   true,   10, NULL,   NULL]
+[ "sys._columns",  "sys",  "sessions", "hostname", "varchar",  
0,  0,  NULL,   true,   11, NULL,   NULL]
+[ "sys._columns",  "sys",  "sessions", "application",  "varchar",  
0,  0,  NULL,   true,   12, NULL,   NULL]
+[ "sys._columns",  "sys",  "sessions", "client",   "varchar",  
0,  0,  NULL,   true,   13, NULL,   NULL]
+[ "sys._columns",  "sys",  "sessions", "clientpid","bigint",   
63, 0,  NULL,   true,   14, NULL,   NULL]
+[ "sys._columns",  "sys",  "sessions", "remark",   "varchar",  
0,  0,  NULL,   true,   15, NULL,   NULL]
 [ "sys._columns",  "sys",  "spatial_ref_sys",  "srid", "int",  31, 
0,  NULL,   false,  0,  NULL,   NULL]
 [ "sys._columns",  "sys",  "spatial_ref_sys",  "auth_name",
"varchar",  256,0,  NULL,   true,   1,  NULL,   NULL]
 [ "sys._columns",  "sys",  "spatial_ref_sys",  "auth_srid","int",  
31, 0,  NULL,   true,   2,  NULL,   NULL]
@@ -2276,7 +2283,8 @@ select 'null in fkeys.delete_action', de
 [ "sys.functions", "sys",  "second",   "SYSTEM",   "seconds",  
"mtime","Internal C",   "Scalar function",  false,  false,  false,  
false,  NULL,   "res_0","int",  31, 0,  "out",  "arg_1",
"sec_interval", 13, 0,  "in",   NULL,   NULL,   NULL,   NULL,   NULL,   
NULL,   NULL,   NULL,   NULL,   NULL,   NULL,   NULL,   NULL,   NULL,   NULL,   
NULL,   NULL,   NULL,   NULL,   NULL,   NULL,   NULL,   NULL,   NULL,   NULL,   
NULL,   NULL,   NULL,   NULL,   NULL,   NULL,   NULL,   NULL,   NULL,   NULL,   
NULL,   NULL,   NULL,   NULL,   NULL,   NULL,   NULL,   NULL,   NULL,   NULL,   
NULL,   NULL,   NULL,   NULL,   NULL,   NULL,   NULL,   NULL,   NULL,   NULL,   
NULL,   NULL,   NULL,   NULL,   NULL,   NULL,   NULL,   NULL,   NULL,   NULL,   
NULL,   NULL,   NULL,   NULL,   NULL]
 [ "sys.functions", "sys",  "second",   "SYSTEM",   "sql_seconds",  
"mtime","Internal C",   "Scalar function",  false,  false,  false,  
false,  NULL,   "res_0","decimal",  9,  6,  "out",  
"arg_1","time", 7,  0,  "in",   NULL,   NULL,   NULL,   NULL,   
NULL,   NULL,   NULL,   NULL,   NULL,   NULL,   NULL,   NULL,   NULL,   NULL,   
NULL,   NULL,   NULL,   NULL,   NULL,   NULL,   NULL,   NULL,   NULL,   NULL,   
NULL,   NULL,   NULL,   NULL,   NULL,   NULL,   NULL,   NULL,   NULL,   NULL,   
NULL,   NULL,   NULL,   NULL,   NULL,   NULL,   NULL,   NULL,   NULL,   NULL,   
NULL,   NULL,   NULL,   NULL,   NULL,   NULL,   NULL,   NULL,   NULL,   NULL,   
NULL,   NULL,   NULL,   NULL,   NULL,   NULL,   NULL,   NULL,   NULL,   NULL,   
NULL,   NULL,   NULL,   NULL,   NULL,   NULL]
 [ "sys.functions", "sys",  "second",   "SYSTEM",   "sql_seconds",  
"mtime","Internal C",   "Scalar function",  false,  false,  false,  
false,  NULL,   "res_0","decimal",  9,  6,  "out",  
"arg_1","timestamp",7,  0,  "in",   NULL,   NULL,   NULL,   
NULL,   NULL,   NULL,   NULL,   NULL,   NULL,   NULL,   NULL,   NULL,   NULL,   
NULL,   NULL,   NULL,   NULL,   NULL,   NULL,   NULL,   NULL,   NULL,   NULL,   
NULL,   NULL,   NULL,   NULL,   NULL,   NULL,   NULL,   NULL,   NULL,   NULL,   
NULL,   NULL,   NULL,   NULL,   NULL,   NULL,   NULL,   NULL,   NULL,   NULL,   
NULL,   NULL,   NULL,   NULL,   NULL,   NULL,   NULL,   NULL,   NULL,   NULL,   
NULL,   NULL,   NULL,   NULL,   NULL,   NULL,   NULL,   NULL,   NULL,   NULL,   
NULL,   NULL,   NULL,   NULL,   NULL,   NULL,   NULL]
-[ "sys.functions", "sys",  "sess

MonetDB: clientinfo - More approves

2024-05-29 Thread Joeri van Ruth via checkin-list
Changeset: e7d4c6fc259f for MonetDB
URL: https://dev.monetdb.org/hg/MonetDB/rev/e7d4c6fc259f
Modified Files:
sql/test/emptydb/Tests/check.stable.out
sql/test/emptydb/Tests/check.stable.out.32bit
sql/test/emptydb/Tests/check.stable.out.int128
Branch: clientinfo
Log Message:

More approves


diffs (121 lines):

diff --git a/sql/test/emptydb/Tests/check.stable.out 
b/sql/test/emptydb/Tests/check.stable.out
--- a/sql/test/emptydb/Tests/check.stable.out
+++ b/sql/test/emptydb/Tests/check.stable.out
@@ -461,6 +461,7 @@ select 'null in fkeys.delete_action', de
 [ "sys._tables",   "sys",  "_tables",  NULL,   "TABLE",true,   
"COMMIT",   "WRITABLE", NULL]
 [ "sys._tables",   "sys",  "args", NULL,   "TABLE",true,   
"COMMIT",   "WRITABLE", NULL]
 [ "sys._tables",   "sys",  "auths",NULL,   "TABLE",true,   
"COMMIT",   "WRITABLE", NULL]
+[ "sys._tables",   "sys",  "clientinfo_properties",NULL,   
"TABLE",true,   "COMMIT",   "WRITABLE", NULL]
 [ "sys._tables",   "sys",  "columns",  "SELECT * FROM (SELECT p.* FROM 
\"sys\".\"_columns\" AS p UNION ALL SELECT t.* FROM \"tmp\".\"_columns\" AS t) 
AS columns;","VIEW", true,   "COMMIT",   "WRITABLE", NULL]
 [ "sys._tables",   "sys",  "comments", NULL,   "TABLE",true,   
"COMMIT",   "WRITABLE", NULL]
 [ "sys._tables",   "sys",  "db_user_info", NULL,   "TABLE",true,   
"COMMIT",   "WRITABLE", NULL]
@@ -929,6 +930,7 @@ select 'null in fkeys.delete_action', de
 [ "sys._columns",  "sys",  "auths","id",   "int",  31, 0,  
NULL,   true,   0,  NULL,   NULL]
 [ "sys._columns",  "sys",  "auths","name", "varchar",  1024,   
0,  NULL,   true,   1,  NULL,   NULL]
 [ "sys._columns",  "sys",  "auths","grantor",  "int",  31, 
0,  NULL,   true,   2,  NULL,   NULL]
+[ "sys._columns",  "sys",  "clientinfo_properties","prop", 
"varchar",  0,  0,  NULL,   true,   0,  NULL,   NULL]
 [ "sys._columns",  "sys",  "columns",  "id",   "int",  31, 0,  
NULL,   true,   0,  NULL,   NULL]
 [ "sys._columns",  "sys",  "columns",  "name", "varchar",  1024,   
0,  NULL,   true,   1,  NULL,   NULL]
 [ "sys._columns",  "sys",  "columns",  "type", "varchar",  1024,   
0,  NULL,   true,   2,  NULL,   NULL]
diff --git a/sql/test/emptydb/Tests/check.stable.out.32bit 
b/sql/test/emptydb/Tests/check.stable.out.32bit
--- a/sql/test/emptydb/Tests/check.stable.out.32bit
+++ b/sql/test/emptydb/Tests/check.stable.out.32bit
@@ -461,6 +461,7 @@ select 'null in fkeys.delete_action', de
 [ "sys._tables",   "sys",  "_tables",  NULL,   "TABLE",true,   
"COMMIT",   "WRITABLE", NULL]
 [ "sys._tables",   "sys",  "args", NULL,   "TABLE",true,   
"COMMIT",   "WRITABLE", NULL]
 [ "sys._tables",   "sys",  "auths",NULL,   "TABLE",true,   
"COMMIT",   "WRITABLE", NULL]
+[ "sys._tables",   "sys",  "clientinfo_properties",NULL,   
"TABLE",true,   "COMMIT",   "WRITABLE", NULL]
 [ "sys._tables",   "sys",  "columns",  "SELECT * FROM (SELECT p.* FROM 
\"sys\".\"_columns\" AS p UNION ALL SELECT t.* FROM \"tmp\".\"_columns\" AS t) 
AS columns;","VIEW", true,   "COMMIT",   "WRITABLE", NULL]
 [ "sys._tables",   "sys",  "comments", NULL,   "TABLE",true,   
"COMMIT",   "WRITABLE", NULL]
 [ "sys._tables",   "sys",  "db_user_info", NULL,   "TABLE",true,   
"COMMIT",   "WRITABLE", NULL]
@@ -929,6 +930,7 @@ select 'null in fkeys.delete_action', de
 [ "sys._columns",  "sys",  "auths","id",   "int",  31, 0,  
NULL,   true,   0,  NULL,   NULL]
 [ "sys._columns",  "sys",  "auths","name", "varchar",  1024,   
0,  NULL,   true,   1,  NULL,   NULL]
 [ "sys._columns",  "sys",  "auths","grantor",  "int",  31, 
0,  NULL,   true,   2,  NULL,   NULL]
+[ "sys._columns",  "sys",  "clientinfo_properties","prop", 
"varchar",  0,  0,  NULL,   true,   0,  NULL,   NULL]
 [ "sys._columns",  "sys",  "columns",  "id",   "int",  31, 0,  
NULL,   true,   0,  NULL,   NULL]
 [ "sys._columns",  "sys",  "columns",  "name", "varchar",  1024,   
0,  NULL,   true,   1,  NULL,   NULL]
 [ "sys._columns",  "sys",  "columns",  "type", "varchar",  1024,   
0,  NULL,   true,   2,  NULL,   NULL]
@@ -1502,6 +1504,13 @@ select 'null in fkeys.delete_action', de
 [ "sys._columns",  "sys",  "sessions", "querytimeout", "int",  31, 
0,  NULL,   true,   6,  NULL,   NULL]
 [ "sys._columns",  "sy

MonetDB: clientinfo - Allow MCsetClientInfo(c, prop, NULL);

2024-05-29 Thread Joeri van Ruth via checkin-list
Changeset: 26caa89f1ffa for MonetDB
URL: https://dev.monetdb.org/hg/MonetDB/rev/26caa89f1ffa
Modified Files:
monetdb5/mal/mal_client.c
Branch: clientinfo
Log Message:

Allow MCsetClientInfo(c, prop, NULL);


diffs (38 lines):

diff --git a/monetdb5/mal/mal_client.c b/monetdb5/mal/mal_client.c
--- a/monetdb5/mal/mal_client.c
+++ b/monetdb5/mal/mal_client.c
@@ -662,29 +662,29 @@ MCsetClientInfo(Client c, const char *pr
case 'H':
if (strcasecmp(property, "ClientHostname") == 0) {
GDKfree(c->client_hostname);
-   c->client_hostname = GDKstrdup(value);
+   c->client_hostname = value ? GDKstrdup(value) : 
NULL;
}
break;
case 'A':
if (strcasecmp(property, "ApplicationName") == 0) {
GDKfree(c->client_application);
-   c->client_application = GDKstrdup(value);
+   c->client_application = value ? 
GDKstrdup(value) : NULL;
}
break;
case 'L':
if (strcasecmp(property, "ClientLibrary") == 0) {
GDKfree(c->client_library);
-   c->client_library = GDKstrdup(value);
+   c->client_library = value ? GDKstrdup(value) : 
NULL;
}
break;
case 'R':
if (strcasecmp(property, "ClientRemark") == 0) {
GDKfree(c->client_remark);
-   c->client_remark = GDKstrdup(value);
+   c->client_remark = value ? GDKstrdup(value) : 
NULL;
}
break;
case 'P':
-   if (strcasecmp(property, "ClientPid") == 0) {
+   if (strcasecmp(property, "ClientPid") == 0 && value != 
NULL) {
char *end;
long n = strtol(value, &end, 10);
if (*value && !*end)
___
checkin-list mailing list -- checkin-list@monetdb.org
To unsubscribe send an email to checkin-list-le...@monetdb.org


MonetDB: clientinfo - Accept Xclientinfo command

2024-05-29 Thread Joeri van Ruth via checkin-list
Changeset: 0eb02f97a5ab for MonetDB
URL: https://dev.monetdb.org/hg/MonetDB/rev/0eb02f97a5ab
Modified Files:
monetdb5/modules/mal/mal_mapi.c
sql/backends/monet5/sql_scenario.c
Branch: clientinfo
Log Message:

Accept Xclientinfo command


diffs (42 lines):

diff --git a/monetdb5/modules/mal/mal_mapi.c b/monetdb5/modules/mal/mal_mapi.c
--- a/monetdb5/modules/mal/mal_mapi.c
+++ b/monetdb5/modules/mal/mal_mapi.c
@@ -225,7 +225,7 @@ doChallenge(void *data)
/* Send the challenge over the block stream
 * We can do binary transfers, and we can interrupt queries using
 * out-of-band messages */
-   mnstr_printf(fdout, "%s:mserver:9:%s:%s:%s:sql=%d:BINARY=1:OOBINTR=1:",
+   mnstr_printf(fdout, 
"%s:mserver:9:%s:%s:%s:sql=%d:BINARY=1:OOBINTR=1:CLIENTINFO:",
 challenge, mcrypt_getHashAlgorithms(),
 #ifdef WORDS_BIGENDIAN
 "BIG",
diff --git a/sql/backends/monet5/sql_scenario.c 
b/sql/backends/monet5/sql_scenario.c
--- a/sql/backends/monet5/sql_scenario.c
+++ b/sql/backends/monet5/sql_scenario.c
@@ -1205,6 +1205,26 @@ SQLchannelcmd(Client c, backend *be)
in->pos = in->len;  /* HACK: should use parsed length */
return MAL_SUCCEED;
}
+   if (strncmp(in->buf + in->pos, "clientinfo\n", 11) == 0) {
+   in->pos += 11;
+   char *end = in->buf + in->len;
+   char *key = in->buf + in->pos;
+   while (key < end) {
+   char *p = memchr(key, '\n', end - key);
+   if (!p)
+   return createException(SQL, "SQLparser", 
SQLSTATE(42000) "no trailing newline in clientinfo");
+   *p = '\0';
+   char *q = memchr(key, '=', p - key);
+   if (!q)
+   return createException(SQL, "SQLparser", 
SQLSTATE(42000) "found no = in clientinfo");
+   *q = '\0';
+   char *value = q + 1;
+   MCsetClientInfo(c, key, *value ? value : NULL);
+   key = p + 1;
+   }
+   in->pos = in->len;
+   return MAL_SUCCEED;
+   }
if (strncmp(in->buf + in->pos, "quit", 4) == 0) {
c->mode = FINISHCLIENT;
in->pos = in->len;  /* HACK: should use parsed length */
___
checkin-list mailing list -- checkin-list@monetdb.org
To unsubscribe send an email to checkin-list-le...@monetdb.org


MonetDB: clientinfo - Switch from Xclientinfo to Xclien...

2024-05-29 Thread Joeri van Ruth via checkin-list
Changeset: fe7d54bdc960 for MonetDB
URL: https://dev.monetdb.org/hg/MonetDB/rev/fe7d54bdc960
Modified Files:
sql/backends/monet5/sql_scenario.c
Branch: clientinfo
Log Message:

Switch from Xclientinfo to Xclientinfo

So we can use mapi_Xcommand()


diffs (12 lines):

diff --git a/sql/backends/monet5/sql_scenario.c 
b/sql/backends/monet5/sql_scenario.c
--- a/sql/backends/monet5/sql_scenario.c
+++ b/sql/backends/monet5/sql_scenario.c
@@ -1205,7 +1205,7 @@ SQLchannelcmd(Client c, backend *be)
in->pos = in->len;  /* HACK: should use parsed length */
return MAL_SUCCEED;
}
-   if (strncmp(in->buf + in->pos, "clientinfo\n", 11) == 0) {
+   if (strncmp(in->buf + in->pos, "clientinfo ", 11) == 0) {
in->pos += 11;
char *end = in->buf + in->len;
char *key = in->buf + in->pos;
___
checkin-list mailing list -- checkin-list@monetdb.org
To unsubscribe send an email to checkin-list-le...@monetdb.org


MonetDB: clientinfo - Send Xclientinfo from libmapi

2024-05-29 Thread Joeri van Ruth via checkin-list
Changeset: fe73197bdceb for MonetDB
URL: https://dev.monetdb.org/hg/MonetDB/rev/fe73197bdceb
Modified Files:
clients/mapilib/connect.c
clients/mapilib/mapi_intern.h
clients/mapilib/msettings.c
clients/mapilib/msettings.h
Branch: clientinfo
Log Message:

Send Xclientinfo from libmapi

ApplicationName and ClientRemark can be set through msettings:
- client_application/MP_CLIENT_APPLICATION,
- client_remark/MP_CLIENT_REMARK,
- client_info/MP_CLIENT_INFO to turn it on and off.

There is no support yet for configuring arbitrary properties, only
these two.  Also the properties cannot yet be changed yet after
connecting.


diffs (200 lines):

diff --git a/clients/mapilib/connect.c b/clients/mapilib/connect.c
--- a/clients/mapilib/connect.c
+++ b/clients/mapilib/connect.c
@@ -24,6 +24,7 @@
 
 #ifdef HAVE_SYS_SOCKET_H
 # include /* addr_in */
+# include/* gethostname() */
 #else /* UNIX specific */
 #ifdef HAVE_WINSOCK_H  /* Windows specific */
 # include 
@@ -380,6 +381,51 @@ connect_socket_tcp_addr(Mapi mid, struct
return s;
 }
 
+static void
+send_all_clientinfo(Mapi mid)
+{
+   msettings *mp = mid->settings;
+   if (!mid->clientinfo_supported)
+   return;
+   if (!msetting_bool(mp, MP_CLIENT_INFO))
+   return;
+
+
+   static char hostname[120] = { 0 };
+   if (hostname[0] == '\0') {
+   if (gethostname(hostname, sizeof(hostname)) != 0)
+   hostname[0] = '\0';
+   hostname[sizeof(hostname) - 1] = '\0';
+   }
+   const char *application_name = msetting_string(mp, 
MP_CLIENT_APPLICATION);
+   const char *client_library = "libmapi " MONETDB_VERSION;
+   const char *client_remark = msetting_string(mp, MP_CLIENT_REMARK);
+   long pid = getpid();
+
+   char *buf = NULL;
+   size_t pos = 0, cap = 200;
+
+   if (hostname[0])
+   reallocprintf(&buf, &pos, &cap, "ClientHostName=%s\n", 
hostname);
+   if (application_name[0])
+   reallocprintf(&buf, &pos, &cap, "ApplicationName=%s\n", 
application_name);
+   reallocprintf(&buf, &pos, &cap, "ClientLibrary=%s\n", client_library);
+   if (client_remark[0])
+   reallocprintf(&buf, &pos, &cap, "ClientRemark=%s\n", 
client_remark);
+   if (pid > 0)
+   reallocprintf(&buf, &pos, &cap, "ClientPid=%ld\n", pid);
+
+   if (pos > 1) {
+   assert(buf[pos - 1] == '\n');
+   pos--;
+   buf[pos] = '\0';
+   }
+
+   if (pos <= cap)
+   mapi_Xcommand(mid, "clientinfo", buf);
+   free(buf);
+}
+
 static MapiMsg
 mapi_handshake(Mapi mid)
 {
@@ -489,15 +535,22 @@ mapi_handshake(Mapi mid)
}
}
 
-   /* search for OOBINTR option,
-* NOTE this consumes the rest of the challenge */
-   char *rest = strtok_r(NULL, ":", &strtok_state);
-   while (rest != NULL) {
-   if (strcmp(rest, "OOBINTR=1") == 0) {
+   /* skip the binary option */
+   char *binary = strtok_r(NULL, ":", &strtok_state);
+   (void)binary;
+
+   char *oobintr = strtok_r(NULL, ":", &strtok_state);
+   if (oobintr) {
+   if (strcmp(oobintr, "OOBINTR=1") == 0) {
mid->oobintr = true;
-   break;
}
-   rest = strtok_r(NULL, ":", &strtok_state);
+   }
+
+   char *clientinfo = strtok_r(NULL, ":", &strtok_state);
+   if (clientinfo) {
+   if (strcmp(oobintr, "OOBINTR=1") == 0) {
+   mid->clientinfo_supported = true;
+   }
}
 
/* hash password, if not already */
@@ -811,6 +864,9 @@ mapi_handshake(Mapi mid)
mapi_set_time_zone(mid, msetting_long(mid->settings, 
MP_TIMEZONE));
}
 
+   if (mid->error == MOK)
+   send_all_clientinfo(mid);
+
return mid->error;
 
 }
diff --git a/clients/mapilib/mapi_intern.h b/clients/mapilib/mapi_intern.h
--- a/clients/mapilib/mapi_intern.h
+++ b/clients/mapilib/mapi_intern.h
@@ -246,6 +246,7 @@ struct MapiStruct {
bool columnar_protocol;
bool sizeheader;
bool oobintr;
+   bool clientinfo_supported;
MapiHdl first;  /* start of doubly-linked list */
MapiHdl active; /* set when not all rows have been received */
 
diff --git a/clients/mapilib/msettings.c b/clients/mapilib/msettings.c
--- a/clients/mapilib/msettings.c
+++ b/clients/mapilib/msettings.c
@@ -84,6 +84,9 @@ by_name[] = {
{ .name="binary", .parm=MP_BINARY },
{ .name="cert", .parm=MP_CERT },
{ .name="certhash", .parm=MP_CERTHASH },
+   { .name="client_application", .parm=MP_CLIENT_APPLICATION },
+   { .name="client_info", .parm=MP_CLIENT_INFO },
+   { .name="client_remark", .parm=MP_CLIENT_REMARK },
{ .name="clientcert", .parm=MP_CLIENTCERT

MonetDB: clientinfo - Add mapi_set_application_name and call it ...

2024-05-29 Thread Joeri van Ruth via checkin-list
Changeset: 7d6f6753c8f3 for MonetDB
URL: https://dev.monetdb.org/hg/MonetDB/rev/7d6f6753c8f3
Modified Files:
clients/mapiclient/mclient.c
clients/mapiclient/msqldump.c
clients/mapilib/connect.c
clients/mapilib/mapi.c
clients/mapilib/mapi.h
clients/mapilib/mapi_intern.h
tools/merovingian/daemon/snapshot.c
Branch: clientinfo
Log Message:

Add mapi_set_application_name and call it in mclient etc.


diffs (99 lines):

diff --git a/clients/mapiclient/mclient.c b/clients/mapiclient/mclient.c
--- a/clients/mapiclient/mclient.c
+++ b/clients/mapiclient/mclient.c
@@ -3682,6 +3682,7 @@ main(int argc, char **argv)
} else {
mid = mapi_mapi(host, port, user, passwd, language, dbname);
}
+   mapi_set_application_name("mclient");
free(user_allocated);
user_allocated = NULL;
free(passwd_allocated);
diff --git a/clients/mapiclient/msqldump.c b/clients/mapiclient/msqldump.c
--- a/clients/mapiclient/msqldump.c
+++ b/clients/mapiclient/msqldump.c
@@ -237,6 +237,7 @@ main(int argc, char **argv)
} else {
mid = mapi_mapi(host, port, user, passwd, "sql", dbname);
}
+   mapi_set_application_name("msqldump");
free(user_allocated);
user_allocated = NULL;
free(passwd_allocated);
diff --git a/clients/mapilib/connect.c b/clients/mapilib/connect.c
--- a/clients/mapilib/connect.c
+++ b/clients/mapilib/connect.c
@@ -398,6 +398,8 @@ send_all_clientinfo(Mapi mid)
hostname[sizeof(hostname) - 1] = '\0';
}
const char *application_name = msetting_string(mp, 
MP_CLIENT_APPLICATION);
+   if (!application_name[0])
+   application_name = mapi_application_name;
const char *client_library = "libmapi " MONETDB_VERSION;
const char *client_remark = msetting_string(mp, MP_CLIENT_REMARK);
long pid = getpid();
diff --git a/clients/mapilib/mapi.c b/clients/mapilib/mapi.c
--- a/clients/mapilib/mapi.c
+++ b/clients/mapilib/mapi.c
@@ -793,6 +793,9 @@ static int mapi_slice_row(struct MapiRes
 static void mapi_store_bind(struct MapiResultSet *result, int cr);
 
 static ATOMIC_FLAG mapi_initialized = ATOMIC_FLAG_INIT;
+
+char mapi_application_name[256] = { 0 };
+
 /*
  * Blocking
  * 
@@ -2118,6 +2121,15 @@ mapi_disconnect(Mapi mid)
return MOK;
 }
 
+void
+mapi_set_application_name(const char *name)
+{
+   if (name)
+   strncpy(mapi_application_name, name, 
sizeof(mapi_application_name));
+   else
+   mapi_application_name[0] = '\0';
+}
+
 /* Set callback function to retrieve or send file content for COPY
  * INTO queries.
  *
diff --git a/clients/mapilib/mapi.h b/clients/mapilib/mapi.h
--- a/clients/mapilib/mapi.h
+++ b/clients/mapilib/mapi.h
@@ -76,6 +76,9 @@ extern "C" {
 # endif
 #endif
 
+/* global state */
+mapi_export void mapi_set_application_name(const char *name);
+
 /* connection-oriented functions */
 mapi_export Mapi mapi_mapi(const char *host, int port, const char *username, 
const char *password, const char *lang, const char *dbname);
 mapi_export Mapi mapi_mapiuri(const char *url, const char *user, const char 
*pass, const char *lang);
diff --git a/clients/mapilib/mapi_intern.h b/clients/mapilib/mapi_intern.h
--- a/clients/mapilib/mapi_intern.h
+++ b/clients/mapilib/mapi_intern.h
@@ -310,6 +310,8 @@ MapiMsg mapi_Xcommand(Mapi mid, const ch
 
 extern const struct MapiStruct MapiStructDefaults;
 
+extern char mapi_application_name[];
+
 // 'settings' will be newly allocated if NULL
 Mapi mapi_new(msettings *settings);
 
diff --git a/tools/merovingian/daemon/snapshot.c 
b/tools/merovingian/daemon/snapshot.c
--- a/tools/merovingian/daemon/snapshot.c
+++ b/tools/merovingian/daemon/snapshot.c
@@ -114,6 +114,7 @@ snapshot_database_stream(char *dbname, s
e = newErr("connection error: %s", mapi_error_str(conn));
goto bailout;
}
+   mapi_set_application_name("monetdbd");
mapi_reconnect(conn);
if (mapi_error(conn) != MOK) {
e = newErr("connection error: %s", mapi_error_str(conn));
___
checkin-list mailing list -- checkin-list@monetdb.org
To unsubscribe send an email to checkin-list-le...@monetdb.org


MonetDB: balanced_union - Merges default

2024-05-29 Thread stefanos mavros via checkin-list
Changeset: 56bc5532d998 for MonetDB
URL: https://dev.monetdb.org/hg/MonetDB/rev/56bc5532d998
Modified Files:
clients/NT/mclient.bat.in
clients/NT/msqldump.bat.in
debian/libmonetdb28.install
monetdb5/NT/M5server.bat.in
sql/ChangeLog.Dec2023
sql/backends/monet5/rel_bin.c
sql/include/sql_relation.h
sql/rel.txt
sql/server/rel_exp.c
sql/server/rel_optimize_others.c
sql/server/rel_optimize_proj.c
sql/server/rel_optimizer.c
sql/server/rel_rel.c
sql/server/rel_rel.h
sql/server/rel_select.c
sql/server/rel_unnest.c
sql/test/emptydb/Tests/check.stable.out.int128
sql/test/strings/Tests/asciify.test
sql/test/strings/Tests/batstr_asciify.test
sql/test/strings/Tests/endswith.test
Branch: balanced_union
Log Message:

Merges default


diffs (truncated from 31141 to 300 lines):

diff --git a/.hgtags b/.hgtags
--- a/.hgtags
+++ b/.hgtags
@@ -826,3 +826,4 @@ dcc8c702e685a4faf21ccf663028d1bc3d1165d1
 d656785f49ee62c19705722aa6b7c171904c64d5 Dec2023_7
 d656785f49ee62c19705722aa6b7c171904c64d5 Dec2023_SP2_release
 9a694c41042503a22d6c92aeab5bc4ca1912b62e Dec2023_9
+9a694c41042503a22d6c92aeab5bc4ca1912b62e Dec2023_SP3_release
diff --git a/ChangeLog b/ChangeLog
--- a/ChangeLog
+++ b/ChangeLog
@@ -1,3 +1,21 @@
 # ChangeLog file for devel
 # This file is updated with Maddlog
 
+* Wed May  8 2024 Sjoerd Mullender 
+- The shared library (.dll aka .so files) now have the version number
+  as part of the name.  This should allow the building of compatibility
+  versions that can be installed in parallel to the latest version.
+- Some of the Debian/Ubuntu packages have been renamed.  The old monetdb5
+  names have been changed to plain monetdb, and libmonetdb5-server-*
+  packages have been renamed monetdb-*.
+- The names of some of the provided RPM files have been changed.
+  References to the old MonetDB5 name have been removed.  All packages
+  are now just MonetDB.
+
+* Wed May  8 2024 Niels Nes 
+- Add support for select exp, count(*) group by 1 order by 1; ie. using
+  numeric references Added support for group by all and order by all. The
+  later is ordering on all columns of the selection.  The group by all
+  finds all expressions from the selections which aren't aggregations
+  and groups on those.  All can also be replaced by '*'.
+
diff --git a/MonetDB.spec b/MonetDB.spec
--- a/MonetDB.spec
+++ b/MonetDB.spec
@@ -8,8 +8,12 @@
 # Copyright August 2008 - 2023 MonetDB B.V.;
 # Copyright 1997 - July 2008 CWI.
 
-%global name MonetDB
 %global version 11.50.0
+
+%bcond_with compat
+
+%global name MonetDB%{?with_compat:%version}
+
 %{!?buildno: %global buildno %(date +%Y%m%d)}
 
 # Use bcond_with to add a --with option; i.e., "without" is default.
@@ -57,7 +61,7 @@
 # available.  However, the geos library is available in the Extra
 # Packages for Enterprise Linux (EPEL).
 %if %{fedpkgs} && (0%{?rhel} != 7) && (0%{?rhel} != 8)
-# By default create the MonetDB-geom-MonetDB5 package on Fedora and RHEL 7
+# By default create the MonetDB-geom package on Fedora and RHEL 7
 %bcond_without geos
 %endif
 
@@ -91,7 +95,7 @@ Group: Applications/Databases
 License: MPL-2.0
 URL: https://www.monetdb.org/
 BugURL: https://github.com/MonetDB/MonetDB/issues
-Source: 
https://www.monetdb.org/downloads/sources/Dec2023-SP3/%{name}-%{version}.tar.bz2
+Source: 
https://www.monetdb.org/downloads/sources/Dec2023-SP3/MonetDB-%{version}.tar.bz2
 
 # The Fedora packaging document says we need systemd-rpm-macros for
 # the _unitdir and _tmpfilesdir macros to exist; however on RHEL 7
@@ -117,7 +121,9 @@ BuildRequires: unixODBC-devel
 BuildRequires: readline-devel
 %else
 BuildRequires: pkgconfig(bzip2)
+%if %{without compat}
 BuildRequires: pkgconfig(odbc)
+%endif
 BuildRequires: pkgconfig(readline)
 %endif
 %if %{with fits}
@@ -154,8 +160,8 @@ BuildRequires: pkgconfig(libR)
 # BuildRequires: pkgconfig(valgrind)# -DWITH_VALGRIND=ON
 
 %if (0%{?fedora} >= 22)
-Recommends: %{name}-SQL-server5%{?_isa} = %{version}-%{release}
-Recommends: MonetDB5-server%{?_isa} = %{version}-%{release}
+Recommends: %{name}-SQL%{?_isa} = %{version}-%{release}
+Recommends: %{name}-server%{?_isa} = %{version}-%{release}
 Suggests: %{name}-client%{?_isa} = %{version}-%{release}
 %endif
 
@@ -167,8 +173,8 @@ accelerators.  It also has an SQL front 
 
 This package contains the core components of MonetDB in the form of a
 single shared library.  If you want to use MonetDB, you will certainly
-need this package, but you will also need at least the MonetDB5-server
-package, and most likely also %{name}-SQL-server5, as well as one or
+need this package, but you will also need at least the %{name}-server
+package, and most likely also %{name}-SQL, as well as one or
 more client packages.
 
 %ldconfig_scriptlets
@@ -176,8 +182,9 @@ more client packages.
 %files
 %license COPYING
 %defattr(-,root,root)
-%{_libdir}/libbat.so.*
+%{_

MonetDB: default - Improve positioning and sizes of group box, d...

2024-05-29 Thread Martin van Dinther via checkin-list
Changeset: 42865269de47 for MonetDB
URL: https://dev.monetdb.org/hg/MonetDB/rev/42865269de47
Modified Files:
clients/odbc/winsetup/resource.h
clients/odbc/winsetup/setup.c
clients/odbc/winsetup/setup.rc
Branch: default
Log Message:

Improve positioning and sizes of group box, data entry fields.
Added unit info text to dialog after timeout (milliseconds) and timezone 
(minutes) data entry fields.
Improve some error message text.
Add data validation and error reporting for the on/off fields: Autocommit and 
TLS.


diffs (235 lines):

diff --git a/clients/odbc/winsetup/resource.h b/clients/odbc/winsetup/resource.h
--- a/clients/odbc/winsetup/resource.h
+++ b/clients/odbc/winsetup/resource.h
@@ -40,7 +40,6 @@
 #define IDC_EDIT_CLIENTKEY  2024
 #define IDC_EDIT_CLIENTCERT 2025
 
-//#define IDC_BUTTON_CANCEL   2031
 #define IDC_BUTTON_TEST 2031
 #define IDC_BUTTON_HELP 2032
 
diff --git a/clients/odbc/winsetup/setup.c b/clients/odbc/winsetup/setup.c
--- a/clients/odbc/winsetup/setup.c
+++ b/clients/odbc/winsetup/setup.c
@@ -93,17 +93,17 @@ struct data {
char *uid;
char *pwd;
char *host;
-   char *port;
+   char *port; /* positive integer */
char *database;
char *schema;
-   char *logintimeout;
-   char *replytimeout;
-   char *replysize;
-   char *autocommit;
-   char *timezone;
+   char *logintimeout; /* empty, 0 or positive integer (millisecs) */
+   char *replytimeout; /* empty, 0 or positive integer (millisecs)  */
+   char *replysize;/* empty, 0 or positive integer */
+   char *autocommit;   /* only on or off allowed */
+   char *timezone; /* empty, 0 or signed integer (minutes) */
char *logfile;
// TLS settings
-   char *use_tls;
+   char *use_tls;  /* only on or off allowed */
char *servercert;
char *servercerthash;
char *clientkey;
@@ -181,7 +181,7 @@ DialogProc(HWND hwndDlg, UINT uMsg, WPAR
if (datap->request != ODBC_ADD_DSN || datap->dsn == 
NULL || *datap->dsn == 0) {
GetDlgItemText(hwndDlg, IDC_EDIT_DSN, buf, 
sizeof(buf));
if (!SQLValidDSN(buf)) {
-   MessageBox(hwndDlg, "Invalid Datasource 
Name", NULL, MB_ICONERROR);
+   MessageBox(hwndDlg, "Invalid or missing 
Data Source Name", NULL, MB_ICONERROR);
return TRUE;
}
if (datap->dsn)
@@ -264,6 +264,12 @@ DialogProc(HWND hwndDlg, UINT uMsg, WPAR
case IDCANCEL:
EndDialog(hwndDlg, LOWORD(wParam));
return TRUE;
+   case IDC_BUTTON_TEST:
+   MessageBox(hwndDlg, "Test Connection not yet 
implemented", NULL, MB_ICONERROR);
+   return TRUE;
+   case IDC_BUTTON_HELP:
+   MessageBox(hwndDlg, "Help not yet implemented", NULL, 
MB_ICONERROR);
+   return TRUE;
}
default:
ODBCLOG("DialogProc 0x%x 0x%x 0x%x\n", uMsg, (unsigned) wParam, 
(unsigned) lParam);
@@ -277,7 +283,7 @@ ConfigDSN(HWND parent, WORD request, LPC
 {
struct data data;
char *dsn = NULL;
-   BOOL rc;
+   BOOL rc = TRUE;  /* we're optimistic: default return value */
 
ODBCLOG("ConfigDSN %d %s %s 0x%" PRIxPTR "\n", request, driver ? driver 
: "(null)", attributes ? attributes : "(null)", (uintptr_t) &data);
 
@@ -419,9 +425,6 @@ ConfigDSN(HWND parent, WORD request, LPC
data.clientkey ? data.clientkey : "(null)",
data.clientcert ? data.clientcert : "(null)");
 
-   /* we're optimistic: default return value */
-   rc = TRUE;
-
if (parent) {
switch (DialogBoxParam(instance,
   MAKEINTRESOURCE(IDD_SETUP_DIALOG),
@@ -443,7 +446,7 @@ ConfigDSN(HWND parent, WORD request, LPC
if (!SQLValidDSN(data.dsn)) {
rc = FALSE;
if (parent)
-   MessageBox(parent, "Invalid Datasource Name", 
NULL, MB_ICONERROR);
+   MessageBox(parent, "Invalid or missing Data 
Source Name", NULL, MB_ICONERROR);
SQLPostInstallerError(ODBC_ERROR_INVALID_NAME, "Invalid 
driver name");
goto finish;
}
@@ -455,14 +458,14 @@ ConfigDSN(HWND parent, WORD request, LPC
if (drv && *drv) {
free(drv);
if (parent &&
-   MessageBox(parent, "Replace existing 
Datasource Name?", NULL, MB_OKCANC

MonetDB: label - windows doesn't like - on unsigned int (even if...

2024-05-29 Thread Niels Nes via checkin-list
Changeset: ba3b5ef210b2 for MonetDB
URL: https://dev.monetdb.org/hg/MonetDB/rev/ba3b5ef210b2
Modified Files:
sql/server/sql_mvc.h
Branch: label
Log Message:

windows doesn't like - on unsigned int (even if result isn't unsigned)


diffs (12 lines):

diff --git a/sql/server/sql_mvc.h b/sql/server/sql_mvc.h
--- a/sql/server/sql_mvc.h
+++ b/sql/server/sql_mvc.h
@@ -160,7 +160,7 @@ typedef struct mvc {
 
/* during query needed flags */
unsigned int label; /* numbers for relational projection labels */
-   unsigned int nid;   /* numbers for relational names */
+   int nid;/* numbers for relational names */
list *cascade_action;  /* protection against recursive cascade actions 
*/
list *schema_path; /* schema search path for object lookup */
uintptr_t sp;
___
checkin-list mailing list -- checkin-list@monetdb.org
To unsubscribe send an email to checkin-list-le...@monetdb.org


MonetDB: label - reverse casts

2024-05-29 Thread Niels Nes via checkin-list
Changeset: 3d9c18c85316 for MonetDB
URL: https://dev.monetdb.org/hg/MonetDB/rev/3d9c18c85316
Modified Files:
sql/server/rel_select.c
sql/server/rel_updates.c
Branch: label
Log Message:

reverse casts

___
checkin-list mailing list -- checkin-list@monetdb.org
To unsubscribe send an email to checkin-list-le...@monetdb.org


MonetDB: label - merged with default

2024-05-29 Thread Niels Nes via checkin-list
Changeset: 9bd0c25c8304 for MonetDB
URL: https://dev.monetdb.org/hg/MonetDB/rev/9bd0c25c8304
Branch: label
Log Message:

merged with default


diffs (235 lines):

diff --git a/clients/odbc/winsetup/resource.h b/clients/odbc/winsetup/resource.h
--- a/clients/odbc/winsetup/resource.h
+++ b/clients/odbc/winsetup/resource.h
@@ -40,7 +40,6 @@
 #define IDC_EDIT_CLIENTKEY  2024
 #define IDC_EDIT_CLIENTCERT 2025
 
-//#define IDC_BUTTON_CANCEL   2031
 #define IDC_BUTTON_TEST 2031
 #define IDC_BUTTON_HELP 2032
 
diff --git a/clients/odbc/winsetup/setup.c b/clients/odbc/winsetup/setup.c
--- a/clients/odbc/winsetup/setup.c
+++ b/clients/odbc/winsetup/setup.c
@@ -93,17 +93,17 @@ struct data {
char *uid;
char *pwd;
char *host;
-   char *port;
+   char *port; /* positive integer */
char *database;
char *schema;
-   char *logintimeout;
-   char *replytimeout;
-   char *replysize;
-   char *autocommit;
-   char *timezone;
+   char *logintimeout; /* empty, 0 or positive integer (millisecs) */
+   char *replytimeout; /* empty, 0 or positive integer (millisecs)  */
+   char *replysize;/* empty, 0 or positive integer */
+   char *autocommit;   /* only on or off allowed */
+   char *timezone; /* empty, 0 or signed integer (minutes) */
char *logfile;
// TLS settings
-   char *use_tls;
+   char *use_tls;  /* only on or off allowed */
char *servercert;
char *servercerthash;
char *clientkey;
@@ -181,7 +181,7 @@ DialogProc(HWND hwndDlg, UINT uMsg, WPAR
if (datap->request != ODBC_ADD_DSN || datap->dsn == 
NULL || *datap->dsn == 0) {
GetDlgItemText(hwndDlg, IDC_EDIT_DSN, buf, 
sizeof(buf));
if (!SQLValidDSN(buf)) {
-   MessageBox(hwndDlg, "Invalid Datasource 
Name", NULL, MB_ICONERROR);
+   MessageBox(hwndDlg, "Invalid or missing 
Data Source Name", NULL, MB_ICONERROR);
return TRUE;
}
if (datap->dsn)
@@ -264,6 +264,12 @@ DialogProc(HWND hwndDlg, UINT uMsg, WPAR
case IDCANCEL:
EndDialog(hwndDlg, LOWORD(wParam));
return TRUE;
+   case IDC_BUTTON_TEST:
+   MessageBox(hwndDlg, "Test Connection not yet 
implemented", NULL, MB_ICONERROR);
+   return TRUE;
+   case IDC_BUTTON_HELP:
+   MessageBox(hwndDlg, "Help not yet implemented", NULL, 
MB_ICONERROR);
+   return TRUE;
}
default:
ODBCLOG("DialogProc 0x%x 0x%x 0x%x\n", uMsg, (unsigned) wParam, 
(unsigned) lParam);
@@ -277,7 +283,7 @@ ConfigDSN(HWND parent, WORD request, LPC
 {
struct data data;
char *dsn = NULL;
-   BOOL rc;
+   BOOL rc = TRUE;  /* we're optimistic: default return value */
 
ODBCLOG("ConfigDSN %d %s %s 0x%" PRIxPTR "\n", request, driver ? driver 
: "(null)", attributes ? attributes : "(null)", (uintptr_t) &data);
 
@@ -419,9 +425,6 @@ ConfigDSN(HWND parent, WORD request, LPC
data.clientkey ? data.clientkey : "(null)",
data.clientcert ? data.clientcert : "(null)");
 
-   /* we're optimistic: default return value */
-   rc = TRUE;
-
if (parent) {
switch (DialogBoxParam(instance,
   MAKEINTRESOURCE(IDD_SETUP_DIALOG),
@@ -443,7 +446,7 @@ ConfigDSN(HWND parent, WORD request, LPC
if (!SQLValidDSN(data.dsn)) {
rc = FALSE;
if (parent)
-   MessageBox(parent, "Invalid Datasource Name", 
NULL, MB_ICONERROR);
+   MessageBox(parent, "Invalid or missing Data 
Source Name", NULL, MB_ICONERROR);
SQLPostInstallerError(ODBC_ERROR_INVALID_NAME, "Invalid 
driver name");
goto finish;
}
@@ -455,14 +458,14 @@ ConfigDSN(HWND parent, WORD request, LPC
if (drv && *drv) {
free(drv);
if (parent &&
-   MessageBox(parent, "Replace existing 
Datasource Name?", NULL, MB_OKCANCEL | MB_ICONQUESTION) != IDOK) {
+   MessageBox(parent, "Replace existing Data 
Source Name?", NULL, MB_OKCANCEL | MB_ICONQUESTION) != IDOK) {
goto finish;
}
ODBCLOG("ConfigDSN removing dsn %s\n", 
data.dsn);
if (!SQLRemoveDSNFromI

MonetDB: balanced_union - fix compilation

2024-05-29 Thread Niels Nes via checkin-list
Changeset: 95964a3415ee for MonetDB
URL: https://dev.monetdb.org/hg/MonetDB/rev/95964a3415ee
Modified Files:
sql/server/rel_optimize_proj.c
Branch: balanced_union
Log Message:

fix compilation


diffs (19 lines):

diff --git a/sql/server/rel_optimize_proj.c b/sql/server/rel_optimize_proj.c
--- a/sql/server/rel_optimize_proj.c
+++ b/sql/server/rel_optimize_proj.c
@@ -3456,6 +3456,7 @@ rel_push_project_down_union(visitor *v, 
  * Push (semi)joins down unions, this is basically for merge tables, where
  * we know that the fk-indices are split over two clustered merge tables.
  */
+#if 0
 static inline sql_rel *
 rel_push_join_down_union(visitor *v, sql_rel *rel)
 {
@@ -3684,6 +3685,7 @@ rel_push_join_down_union(visitor *v, sql
}
return rel;
 }
+#endif
 
 /*
  * Push (semi)joins down unions, this is basically for merge tables, where
___
checkin-list mailing list -- checkin-list@monetdb.org
To unsubscribe send an email to checkin-list-le...@monetdb.org


MonetDB: balanced_union - merged with default

2024-05-29 Thread Niels Nes via checkin-list
Changeset: cf178ae7e83d for MonetDB
URL: https://dev.monetdb.org/hg/MonetDB/rev/cf178ae7e83d
Branch: balanced_union
Log Message:

merged with default


diffs (235 lines):

diff --git a/clients/odbc/winsetup/resource.h b/clients/odbc/winsetup/resource.h
--- a/clients/odbc/winsetup/resource.h
+++ b/clients/odbc/winsetup/resource.h
@@ -40,7 +40,6 @@
 #define IDC_EDIT_CLIENTKEY  2024
 #define IDC_EDIT_CLIENTCERT 2025
 
-//#define IDC_BUTTON_CANCEL   2031
 #define IDC_BUTTON_TEST 2031
 #define IDC_BUTTON_HELP 2032
 
diff --git a/clients/odbc/winsetup/setup.c b/clients/odbc/winsetup/setup.c
--- a/clients/odbc/winsetup/setup.c
+++ b/clients/odbc/winsetup/setup.c
@@ -93,17 +93,17 @@ struct data {
char *uid;
char *pwd;
char *host;
-   char *port;
+   char *port; /* positive integer */
char *database;
char *schema;
-   char *logintimeout;
-   char *replytimeout;
-   char *replysize;
-   char *autocommit;
-   char *timezone;
+   char *logintimeout; /* empty, 0 or positive integer (millisecs) */
+   char *replytimeout; /* empty, 0 or positive integer (millisecs)  */
+   char *replysize;/* empty, 0 or positive integer */
+   char *autocommit;   /* only on or off allowed */
+   char *timezone; /* empty, 0 or signed integer (minutes) */
char *logfile;
// TLS settings
-   char *use_tls;
+   char *use_tls;  /* only on or off allowed */
char *servercert;
char *servercerthash;
char *clientkey;
@@ -181,7 +181,7 @@ DialogProc(HWND hwndDlg, UINT uMsg, WPAR
if (datap->request != ODBC_ADD_DSN || datap->dsn == 
NULL || *datap->dsn == 0) {
GetDlgItemText(hwndDlg, IDC_EDIT_DSN, buf, 
sizeof(buf));
if (!SQLValidDSN(buf)) {
-   MessageBox(hwndDlg, "Invalid Datasource 
Name", NULL, MB_ICONERROR);
+   MessageBox(hwndDlg, "Invalid or missing 
Data Source Name", NULL, MB_ICONERROR);
return TRUE;
}
if (datap->dsn)
@@ -264,6 +264,12 @@ DialogProc(HWND hwndDlg, UINT uMsg, WPAR
case IDCANCEL:
EndDialog(hwndDlg, LOWORD(wParam));
return TRUE;
+   case IDC_BUTTON_TEST:
+   MessageBox(hwndDlg, "Test Connection not yet 
implemented", NULL, MB_ICONERROR);
+   return TRUE;
+   case IDC_BUTTON_HELP:
+   MessageBox(hwndDlg, "Help not yet implemented", NULL, 
MB_ICONERROR);
+   return TRUE;
}
default:
ODBCLOG("DialogProc 0x%x 0x%x 0x%x\n", uMsg, (unsigned) wParam, 
(unsigned) lParam);
@@ -277,7 +283,7 @@ ConfigDSN(HWND parent, WORD request, LPC
 {
struct data data;
char *dsn = NULL;
-   BOOL rc;
+   BOOL rc = TRUE;  /* we're optimistic: default return value */
 
ODBCLOG("ConfigDSN %d %s %s 0x%" PRIxPTR "\n", request, driver ? driver 
: "(null)", attributes ? attributes : "(null)", (uintptr_t) &data);
 
@@ -419,9 +425,6 @@ ConfigDSN(HWND parent, WORD request, LPC
data.clientkey ? data.clientkey : "(null)",
data.clientcert ? data.clientcert : "(null)");
 
-   /* we're optimistic: default return value */
-   rc = TRUE;
-
if (parent) {
switch (DialogBoxParam(instance,
   MAKEINTRESOURCE(IDD_SETUP_DIALOG),
@@ -443,7 +446,7 @@ ConfigDSN(HWND parent, WORD request, LPC
if (!SQLValidDSN(data.dsn)) {
rc = FALSE;
if (parent)
-   MessageBox(parent, "Invalid Datasource Name", 
NULL, MB_ICONERROR);
+   MessageBox(parent, "Invalid or missing Data 
Source Name", NULL, MB_ICONERROR);
SQLPostInstallerError(ODBC_ERROR_INVALID_NAME, "Invalid 
driver name");
goto finish;
}
@@ -455,14 +458,14 @@ ConfigDSN(HWND parent, WORD request, LPC
if (drv && *drv) {
free(drv);
if (parent &&
-   MessageBox(parent, "Replace existing 
Datasource Name?", NULL, MB_OKCANCEL | MB_ICONQUESTION) != IDOK) {
+   MessageBox(parent, "Replace existing Data 
Source Name?", NULL, MB_OKCANCEL | MB_ICONQUESTION) != IDOK) {
goto finish;
}
ODBCLOG("ConfigDSN removing dsn %s\n", 
data.dsn);
if (!SQLRemov

MonetDB: check - merged with default

2024-05-29 Thread Niels Nes via checkin-list
Changeset: 2a6ab1a31cb4 for MonetDB
URL: https://dev.monetdb.org/hg/MonetDB/rev/2a6ab1a31cb4
Modified Files:
sql/server/rel_select.c
sql/storage/store.c
Branch: check
Log Message:

merged with default


diffs (truncated from 5181 to 300 lines):

diff --git a/clients/Tests/exports.stable.out b/clients/Tests/exports.stable.out
--- a/clients/Tests/exports.stable.out
+++ b/clients/Tests/exports.stable.out
@@ -745,12 +745,23 @@ const char *mo_find_option(opt *set, int
 void mo_free_options(opt *set, int setlen);
 void mo_print_options(opt *set, int setlen);
 int mo_system_config(opt **Set, int setlen);
+mparm mparm_enumerate(int i);
+bool mparm_is_core(mparm parm);
+const char *mparm_name(mparm parm);
 mparm mparm_parse(const char *name);
+char *msetting_as_string(const msettings *mp, mparm parm);
 bool msetting_bool(const msettings *mp, mparm parm);
 long msetting_long(const msettings *mp, mparm parm);
+const char *msetting_parm_name(const msettings *mp, mparm parm);
+msettings_error msetting_parse(msettings *mp, mparm parm, const char *text);
 int msetting_parse_bool(const char *text);
+msettings_error msetting_set_bool(msettings *mp, mparm parm, bool value);
+msettings_error msetting_set_ignored(msettings *mp, const char *key, const 
char *value);
+msettings_error msetting_set_long(msettings *mp, mparm parm, long value);
 msettings_error msetting_set_named(msettings *mp, bool allow_core, const char 
*key, const char *value);
+msettings_error msetting_set_string(msettings *mp, mparm parm, const char 
*value) __attribute__((__nonnull__(3)));
 const char *msetting_string(const msettings *mp, mparm parm);
+msettings *msettings_clone(const msettings *mp);
 long msettings_connect_binary(const msettings *mp);
 const char *msettings_connect_certhash_digits(const msettings *mp);
 const char *msettings_connect_clientcert(const msettings *mp);
@@ -761,8 +772,12 @@ const char *msettings_connect_tcp(const 
 enum msetting_tls_verify msettings_connect_tls_verify(const msettings *mp);
 const char *msettings_connect_unix(const msettings *mp);
 msettings *msettings_create(void);
+const msettings *msettings_default;
 msettings *msettings_destroy(msettings *mp);
+bool msettings_malloc_failed(msettings_error err);
 bool msettings_parse_url(msettings *mp, const char *url, char **error_buffer);
+void msettings_reset(msettings *mp);
+void msettings_set_localizer(msettings *mp, const char *(*localizer)(const 
void *data, mparm parm), void *data);
 bool msettings_validate(msettings *mp, char **errmsg);
 const char *wsaerror(int);
 
diff --git a/clients/examples/C/testsfile.c b/clients/examples/C/testsfile.c
--- a/clients/examples/C/testsfile.c
+++ b/clients/examples/C/testsfile.c
@@ -85,7 +85,7 @@ handle_set_command(const char *location,
 {
msettings_error msg = msetting_set_named(mp, true, key, value);
if (msg) {
-   fprintf(stderr, "%s: cannot set '%s': %s\n", location, key, 
msg);
+   fprintf(stderr, "%s: %s\n", location, msg);
return false;
}
return true;
diff --git a/clients/mapiclient/mclient.c b/clients/mapiclient/mclient.c
--- a/clients/mapiclient/mclient.c
+++ b/clients/mapiclient/mclient.c
@@ -174,7 +174,7 @@ static char *nullstring = default_nullst
 static timertype
 gettime(void)
 {
-   /* Return the time in milliseconds since an epoch.  The epoch
+   /* Return the time in microseconds since an epoch.  The epoch
   is roughly the time this program started. */
 #ifdef _MSC_VER
static LARGE_INTEGER freq, start;   /* automatically initialized to 
0 */
@@ -389,7 +389,7 @@ utf8strlenmax(char *s, char *e, size_t m
case UTF8_ACCEPT:
if (codepoint == '\n') {
if (max) {
-   *t = s;
+   *t = s - 1; /* before the \n */
return len;
}
len++;
@@ -409,7 +409,11 @@ utf8strlenmax(char *s, char *e, size_t m
return len0;
}
if (len == max) {
-   *t = s;
+   /* add any following combining (zero 
width) characters */
+   do {
+   *t = s;
+   s = nextcharn(s, e == NULL ? 4 
: (size_t) (e - s), &codepoint);
+   } while (codepoint > 0 && 
charwidth(codepoint) == 0);
return len;
}
}
diff --git a/clients/mapilib/connect.c b/clients/mapilib/connect.c
--- a/clients/mapilib/connect.c
+++ b/clients/mapilib/connect.c
@@ -144,6 +144,17 @@ establish_connection(Mapi mid)

MonetDB: clientinfo - use sizeof -1 when calling strncpy to leav...

2024-05-29 Thread Niels Nes via checkin-list
Changeset: b8c415c75320 for MonetDB
URL: https://dev.monetdb.org/hg/MonetDB/rev/b8c415c75320
Modified Files:
clients/mapilib/mapi.c
Branch: clientinfo
Log Message:

use sizeof -1 when calling strncpy to leave room for the 0


diffs (12 lines):

diff --git a/clients/mapilib/mapi.c b/clients/mapilib/mapi.c
--- a/clients/mapilib/mapi.c
+++ b/clients/mapilib/mapi.c
@@ -2125,7 +2125,7 @@ void
 mapi_set_application_name(const char *name)
 {
if (name)
-   strncpy(mapi_application_name, name, 
sizeof(mapi_application_name));
+   strncpy(mapi_application_name, name, 
sizeof(mapi_application_name)-1);
else
mapi_application_name[0] = '\0';
 }
___
checkin-list mailing list -- checkin-list@monetdb.org
To unsubscribe send an email to checkin-list-le...@monetdb.org


MonetDB: clientinfo - merged with default

2024-05-29 Thread Niels Nes via checkin-list
Changeset: efbfa8437dc8 for MonetDB
URL: https://dev.monetdb.org/hg/MonetDB/rev/efbfa8437dc8
Branch: clientinfo
Log Message:

merged with default


diffs (235 lines):

diff --git a/clients/odbc/winsetup/resource.h b/clients/odbc/winsetup/resource.h
--- a/clients/odbc/winsetup/resource.h
+++ b/clients/odbc/winsetup/resource.h
@@ -40,7 +40,6 @@
 #define IDC_EDIT_CLIENTKEY  2024
 #define IDC_EDIT_CLIENTCERT 2025
 
-//#define IDC_BUTTON_CANCEL   2031
 #define IDC_BUTTON_TEST 2031
 #define IDC_BUTTON_HELP 2032
 
diff --git a/clients/odbc/winsetup/setup.c b/clients/odbc/winsetup/setup.c
--- a/clients/odbc/winsetup/setup.c
+++ b/clients/odbc/winsetup/setup.c
@@ -93,17 +93,17 @@ struct data {
char *uid;
char *pwd;
char *host;
-   char *port;
+   char *port; /* positive integer */
char *database;
char *schema;
-   char *logintimeout;
-   char *replytimeout;
-   char *replysize;
-   char *autocommit;
-   char *timezone;
+   char *logintimeout; /* empty, 0 or positive integer (millisecs) */
+   char *replytimeout; /* empty, 0 or positive integer (millisecs)  */
+   char *replysize;/* empty, 0 or positive integer */
+   char *autocommit;   /* only on or off allowed */
+   char *timezone; /* empty, 0 or signed integer (minutes) */
char *logfile;
// TLS settings
-   char *use_tls;
+   char *use_tls;  /* only on or off allowed */
char *servercert;
char *servercerthash;
char *clientkey;
@@ -181,7 +181,7 @@ DialogProc(HWND hwndDlg, UINT uMsg, WPAR
if (datap->request != ODBC_ADD_DSN || datap->dsn == 
NULL || *datap->dsn == 0) {
GetDlgItemText(hwndDlg, IDC_EDIT_DSN, buf, 
sizeof(buf));
if (!SQLValidDSN(buf)) {
-   MessageBox(hwndDlg, "Invalid Datasource 
Name", NULL, MB_ICONERROR);
+   MessageBox(hwndDlg, "Invalid or missing 
Data Source Name", NULL, MB_ICONERROR);
return TRUE;
}
if (datap->dsn)
@@ -264,6 +264,12 @@ DialogProc(HWND hwndDlg, UINT uMsg, WPAR
case IDCANCEL:
EndDialog(hwndDlg, LOWORD(wParam));
return TRUE;
+   case IDC_BUTTON_TEST:
+   MessageBox(hwndDlg, "Test Connection not yet 
implemented", NULL, MB_ICONERROR);
+   return TRUE;
+   case IDC_BUTTON_HELP:
+   MessageBox(hwndDlg, "Help not yet implemented", NULL, 
MB_ICONERROR);
+   return TRUE;
}
default:
ODBCLOG("DialogProc 0x%x 0x%x 0x%x\n", uMsg, (unsigned) wParam, 
(unsigned) lParam);
@@ -277,7 +283,7 @@ ConfigDSN(HWND parent, WORD request, LPC
 {
struct data data;
char *dsn = NULL;
-   BOOL rc;
+   BOOL rc = TRUE;  /* we're optimistic: default return value */
 
ODBCLOG("ConfigDSN %d %s %s 0x%" PRIxPTR "\n", request, driver ? driver 
: "(null)", attributes ? attributes : "(null)", (uintptr_t) &data);
 
@@ -419,9 +425,6 @@ ConfigDSN(HWND parent, WORD request, LPC
data.clientkey ? data.clientkey : "(null)",
data.clientcert ? data.clientcert : "(null)");
 
-   /* we're optimistic: default return value */
-   rc = TRUE;
-
if (parent) {
switch (DialogBoxParam(instance,
   MAKEINTRESOURCE(IDD_SETUP_DIALOG),
@@ -443,7 +446,7 @@ ConfigDSN(HWND parent, WORD request, LPC
if (!SQLValidDSN(data.dsn)) {
rc = FALSE;
if (parent)
-   MessageBox(parent, "Invalid Datasource Name", 
NULL, MB_ICONERROR);
+   MessageBox(parent, "Invalid or missing Data 
Source Name", NULL, MB_ICONERROR);
SQLPostInstallerError(ODBC_ERROR_INVALID_NAME, "Invalid 
driver name");
goto finish;
}
@@ -455,14 +458,14 @@ ConfigDSN(HWND parent, WORD request, LPC
if (drv && *drv) {
free(drv);
if (parent &&
-   MessageBox(parent, "Replace existing 
Datasource Name?", NULL, MB_OKCANCEL | MB_ICONQUESTION) != IDOK) {
+   MessageBox(parent, "Replace existing Data 
Source Name?", NULL, MB_OKCANCEL | MB_ICONQUESTION) != IDOK) {
goto finish;
}
ODBCLOG("ConfigDSN removing dsn %s\n", 
data.dsn);
if (!SQLRemoveDSN

MonetDB: clientinfo - approved new functions

2024-05-29 Thread Niels Nes via checkin-list
Changeset: 247c26c97bbf for MonetDB
URL: https://dev.monetdb.org/hg/MonetDB/rev/247c26c97bbf
Modified Files:
clients/Tests/MAL-signatures-hge.test
clients/Tests/MAL-signatures.test
clients/Tests/exports.stable.out
Branch: clientinfo
Log Message:

approved new functions


diffs (59 lines):

diff --git a/clients/Tests/MAL-signatures-hge.test 
b/clients/Tests/MAL-signatures-hge.test
--- a/clients/Tests/MAL-signatures-hge.test
+++ b/clients/Tests/MAL-signatures-hge.test
@@ -44629,6 +44629,11 @@ unsafe pattern clients.setScenario(X_0:s
 CLTsetScenario;
 Switch to other scenario handler, return previous one.
 clients
+setinfo
+unsafe pattern clients.setinfo(X_0:str, X_1:str):str
+CLTsetClientInfo;
+set a clientinfo property
+clients
 setmemorylimit
 unsafe pattern clients.setmemorylimit(X_0:int):void
 CLTsetmemorylimit;
@@ -49640,7 +49645,7 @@ SQLrow_number;
 return the row_numer-ed groups
 sql
 sessions
-pattern sql.sessions() (X_0:bat[:int], X_1:bat[:str], X_2:bat[:timestamp], 
X_3:bat[:timestamp], X_4:bat[:str], X_5:bat[:int], X_6:bat[:int], 
X_7:bat[:int], X_8:bat[:int])
+pattern sql.sessions() (X_0:bat[:int], X_1:bat[:str], X_2:bat[:timestamp], 
X_3:bat[:timestamp], X_4:bat[:str], X_5:bat[:int], X_6:bat[:int], 
X_7:bat[:int], X_8:bat[:int], X_9:bat[:str], X_10:bat[:str], X_11:bat[:str], 
X_12:bat[:str], X_13:bat[:str], X_14:bat[:lng], X_15:bat[:str])
 sql_sessions_wrap;
 SQL export table of active sessions, their timeouts and idle status
 sql
diff --git a/clients/Tests/MAL-signatures.test 
b/clients/Tests/MAL-signatures.test
--- a/clients/Tests/MAL-signatures.test
+++ b/clients/Tests/MAL-signatures.test
@@ -33164,6 +33164,11 @@ unsafe pattern clients.setScenario(X_0:s
 CLTsetScenario;
 Switch to other scenario handler, return previous one.
 clients
+setinfo
+unsafe pattern clients.setinfo(X_0:str, X_1:str):str
+CLTsetClientInfo;
+set a clientinfo property
+clients
 setmemorylimit
 unsafe pattern clients.setmemorylimit(X_0:int):void
 CLTsetmemorylimit;
@@ -38060,7 +38065,7 @@ SQLrow_number;
 return the row_numer-ed groups
 sql
 sessions
-pattern sql.sessions() (X_0:bat[:int], X_1:bat[:str], X_2:bat[:timestamp], 
X_3:bat[:timestamp], X_4:bat[:str], X_5:bat[:int], X_6:bat[:int], 
X_7:bat[:int], X_8:bat[:int])
+pattern sql.sessions() (X_0:bat[:int], X_1:bat[:str], X_2:bat[:timestamp], 
X_3:bat[:timestamp], X_4:bat[:str], X_5:bat[:int], X_6:bat[:int], 
X_7:bat[:int], X_8:bat[:int], X_9:bat[:str], X_10:bat[:str], X_11:bat[:str], 
X_12:bat[:str], X_13:bat[:str], X_14:bat[:lng], X_15:bat[:str])
 sql_sessions_wrap;
 SQL export table of active sessions, their timeouts and idle status
 sql
diff --git a/clients/Tests/exports.stable.out b/clients/Tests/exports.stable.out
--- a/clients/Tests/exports.stable.out
+++ b/clients/Tests/exports.stable.out
@@ -717,6 +717,7 @@ int64_t mapi_rows_affected(MapiHdl hdl) 
 MapiMsg mapi_seek_row(MapiHdl hdl, int64_t rowne, int whence) 
__attribute__((__nonnull__(1)));
 MapiHdl mapi_send(Mapi mid, const char *cmd) __attribute__((__nonnull__(1)));
 MapiMsg mapi_setAutocommit(Mapi mid, bool autocommit) 
__attribute__((__nonnull__(1)));
+void mapi_set_application_name(const char *name);
 MapiMsg mapi_set_columnar_protocol(Mapi mid, bool columnar_protocol) 
__attribute__((__nonnull__(1)));
 MapiMsg mapi_set_size_header(Mapi mid, bool value) 
__attribute__((__nonnull__(1)));
 MapiMsg mapi_set_time_zone(Mapi mid, int seconds_east_of_utc) 
__attribute__((__nonnull__(1)));
___
checkin-list mailing list -- checkin-list@monetdb.org
To unsubscribe send an email to checkin-list-le...@monetdb.org


MonetDB: clientinfo - add cast

2024-05-29 Thread Niels Nes via checkin-list
Changeset: eb4dc2f9ede3 for MonetDB
URL: https://dev.monetdb.org/hg/MonetDB/rev/eb4dc2f9ede3
Modified Files:
monetdb5/modules/mal/mal_mapi.c
Branch: clientinfo
Log Message:

add cast


diffs (12 lines):

diff --git a/monetdb5/modules/mal/mal_mapi.c b/monetdb5/modules/mal/mal_mapi.c
--- a/monetdb5/modules/mal/mal_mapi.c
+++ b/monetdb5/modules/mal/mal_mapi.c
@@ -195,7 +195,7 @@ doChallenge(void *data)
char service[20];
if (0 == getnameinfo(
(struct sockaddr*)&chdata->peer, 
chdata->peerlen,
-   p, peer_end - p - 10,
+   p, (int)(peer_end - p - 10),
service, sizeof(service),
NI_NUMERICSERV | NI_NUMERICHOST)
) {
___
checkin-list mailing list -- checkin-list@monetdb.org
To unsubscribe send an email to checkin-list-le...@monetdb.org


MonetDB: nilmask - merged with default

2024-05-29 Thread Niels Nes via checkin-list
Changeset: cda0f55546e6 for MonetDB
URL: https://dev.monetdb.org/hg/MonetDB/rev/cda0f55546e6
Modified Files:
clients/Tests/MAL-signatures-hge.test
clients/Tests/MAL-signatures.test
clients/Tests/exports.stable.out
gdk/gdk.h
gdk/gdk_bat.c
monetdb5/modules/atoms/CMakeLists.txt
monetdb5/modules/mal/tablet.c
sql/backends/monet5/rel_bin.c
sql/backends/monet5/sql.c
sql/backends/monet5/sql_result.c
sql/include/sql_catalog.h
sql/storage/bat/bat_storage.c
sql/storage/store.c
tools/monetdbe/monetdbe.c
Branch: nilmask
Log Message:

merged with default


diffs (truncated from 41850 to 300 lines):

diff --git a/.hgtags b/.hgtags
--- a/.hgtags
+++ b/.hgtags
@@ -825,3 +825,5 @@ dcc8c702e685a4faf21ccf663028d1bc3d1165d1
 dcc8c702e685a4faf21ccf663028d1bc3d1165d1 Dec2023_SP1_release
 d656785f49ee62c19705722aa6b7c171904c64d5 Dec2023_7
 d656785f49ee62c19705722aa6b7c171904c64d5 Dec2023_SP2_release
+9a694c41042503a22d6c92aeab5bc4ca1912b62e Dec2023_9
+9a694c41042503a22d6c92aeab5bc4ca1912b62e Dec2023_SP3_release
diff --git a/ChangeLog b/ChangeLog
--- a/ChangeLog
+++ b/ChangeLog
@@ -1,3 +1,21 @@
 # ChangeLog file for devel
 # This file is updated with Maddlog
 
+* Wed May  8 2024 Sjoerd Mullender 
+- The shared library (.dll aka .so files) now have the version number
+  as part of the name.  This should allow the building of compatibility
+  versions that can be installed in parallel to the latest version.
+- Some of the Debian/Ubuntu packages have been renamed.  The old monetdb5
+  names have been changed to plain monetdb, and libmonetdb5-server-*
+  packages have been renamed monetdb-*.
+- The names of some of the provided RPM files have been changed.
+  References to the old MonetDB5 name have been removed.  All packages
+  are now just MonetDB.
+
+* Wed May  8 2024 Niels Nes 
+- Add support for select exp, count(*) group by 1 order by 1; ie. using
+  numeric references Added support for group by all and order by all. The
+  later is ordering on all columns of the selection.  The group by all
+  finds all expressions from the selections which aren't aggregations
+  and groups on those.  All can also be replaced by '*'.
+
diff --git a/MonetDB.spec b/MonetDB.spec
--- a/MonetDB.spec
+++ b/MonetDB.spec
@@ -8,8 +8,12 @@
 # Copyright August 2008 - 2023 MonetDB B.V.;
 # Copyright 1997 - July 2008 CWI.
 
-%global name MonetDB
 %global version 11.50.0
+
+%bcond_with compat
+
+%global name MonetDB%{?with_compat:%version}
+
 %{!?buildno: %global buildno %(date +%Y%m%d)}
 
 # Use bcond_with to add a --with option; i.e., "without" is default.
@@ -57,7 +61,7 @@
 # available.  However, the geos library is available in the Extra
 # Packages for Enterprise Linux (EPEL).
 %if %{fedpkgs} && (0%{?rhel} != 7) && (0%{?rhel} != 8)
-# By default create the MonetDB-geom-MonetDB5 package on Fedora and RHEL 7
+# By default create the MonetDB-geom package on Fedora and RHEL 7
 %bcond_without geos
 %endif
 
@@ -91,7 +95,7 @@ Group: Applications/Databases
 License: MPL-2.0
 URL: https://www.monetdb.org/
 BugURL: https://github.com/MonetDB/MonetDB/issues
-Source: 
https://www.monetdb.org/downloads/sources/Dec2023-SP2/%{name}-%{version}.tar.bz2
+Source: 
https://www.monetdb.org/downloads/sources/Dec2023-SP3/MonetDB-%{version}.tar.bz2
 
 # The Fedora packaging document says we need systemd-rpm-macros for
 # the _unitdir and _tmpfilesdir macros to exist; however on RHEL 7
@@ -117,7 +121,9 @@ BuildRequires: unixODBC-devel
 BuildRequires: readline-devel
 %else
 BuildRequires: pkgconfig(bzip2)
+%if %{without compat}
 BuildRequires: pkgconfig(odbc)
+%endif
 BuildRequires: pkgconfig(readline)
 %endif
 %if %{with fits}
@@ -154,8 +160,8 @@ BuildRequires: pkgconfig(libR)
 # BuildRequires: pkgconfig(valgrind)# -DWITH_VALGRIND=ON
 
 %if (0%{?fedora} >= 22)
-Recommends: %{name}-SQL-server5%{?_isa} = %{version}-%{release}
-Recommends: MonetDB5-server%{?_isa} = %{version}-%{release}
+Recommends: %{name}-SQL%{?_isa} = %{version}-%{release}
+Recommends: %{name}-server%{?_isa} = %{version}-%{release}
 Suggests: %{name}-client%{?_isa} = %{version}-%{release}
 %endif
 
@@ -167,8 +173,8 @@ accelerators.  It also has an SQL front 
 
 This package contains the core components of MonetDB in the form of a
 single shared library.  If you want to use MonetDB, you will certainly
-need this package, but you will also need at least the MonetDB5-server
-package, and most likely also %{name}-SQL-server5, as well as one or
+need this package, but you will also need at least the %{name}-server
+package, and most likely also %{name}-SQL, as well as one or
 more client packages.
 
 %ldconfig_scriptlets
@@ -176,8 +182,9 @@ more client packages.
 %files
 %license COPYING
 %defattr(-,root,root)
-%{_libdir}/libbat.so.*
+%{_libdir}/libbat*.so.*
 
+%if %{without compat}
 %package devel
 Summary: MonetDB development files
 Group: Applications/Databases
@@ -202,8 +209,9 @@ functionality of