Changeset: ee8417a8fe9b for MonetDB
URL: https://dev.monetdb.org/hg/MonetDB/rev/ee8417a8fe9b
Branch: default
Log Message:
merged
diffs (truncated from 491 to 300 lines):
diff --git a/clients/mapiclient/curl-stream.h b/clients/mapiclient/curl-stream.h
--- a/clients/mapiclient/curl-stream.h
+++ b/clients/mapiclient/curl-stream.h
@@ -9,6 +9,7 @@
*/
#include <curl/curl.h>
+#include "stream.h"
#ifndef CURL_WRITEFUNC_ERROR
#define CURL_WRITEFUNC_ERROR 0
diff --git a/clients/mapiclient/dotmonetdb.h b/clients/mapiclient/dotmonetdb.h
--- a/clients/mapiclient/dotmonetdb.h
+++ b/clients/mapiclient/dotmonetdb.h
@@ -8,6 +8,8 @@
* For copyright information, see the file debian/copyright.
*/
+#include <stdbool.h>
+
typedef struct DotMonetdb {
char *user;
char *passwd;
diff --git a/clients/mapiclient/iconv-stream.h
b/clients/mapiclient/iconv-stream.h
--- a/clients/mapiclient/iconv-stream.h
+++ b/clients/mapiclient/iconv-stream.h
@@ -9,6 +9,7 @@
*/
#include <iconv.h>
+#include "stream.h"
struct ic_priv_t {
stream *s;
diff --git a/clients/mapiclient/mclient.c b/clients/mapiclient/mclient.c
--- a/clients/mapiclient/mclient.c
+++ b/clients/mapiclient/mclient.c
@@ -3125,64 +3125,7 @@ doFile(Mapi mid, stream *fp, bool useins
}
#ifdef HAVE_CURL
-#include <curl/curl.h>
-
-#ifndef CURL_WRITEFUNC_ERROR
-#define CURL_WRITEFUNC_ERROR 0
-#endif
-
-static size_t
-write_callback(char *buffer, size_t size, size_t nitems, void *userp)
-{
- stream *s = userp;
-
- /* size is expected to always be 1 */
-
- ssize_t sz = mnstr_write(s, buffer, size, nitems);
- if (sz < 0)
- return CURL_WRITEFUNC_ERROR; /* indicate failure to library */
- return (size_t) sz * size;
-}
-
-static stream *
-open_urlstream(const char *url, char *errbuf)
-{
- CURL *handle;
- stream *s;
- CURLcode ret;
-
- s = buffer_wastream(NULL, url);
- if (s == NULL) {
- snprintf(errbuf, CURL_ERROR_SIZE, "could not allocate memory");
- return NULL;
- }
-
- if ((handle = curl_easy_init()) == NULL) {
- mnstr_destroy(s);
- snprintf(errbuf, CURL_ERROR_SIZE, "could not create CURL
handle");
- return NULL;
- }
-
- errbuf[0] = 0;
-
- if ((ret = curl_easy_setopt(handle, CURLOPT_ERRORBUFFER, errbuf)) !=
CURLE_OK ||
- (ret = curl_easy_setopt(handle, CURLOPT_URL, url)) != CURLE_OK ||
- (ret = curl_easy_setopt(handle, CURLOPT_WRITEDATA, s)) != CURLE_OK
||
- (ret = curl_easy_setopt(handle, CURLOPT_VERBOSE, 0L)) != CURLE_OK ||
- (ret = curl_easy_setopt(handle, CURLOPT_NOSIGNAL, 1L)) != CURLE_OK
||
- (ret = curl_easy_setopt(handle, CURLOPT_FAILONERROR, 1L)) !=
CURLE_OK ||
- (ret = curl_easy_setopt(handle, CURLOPT_WRITEFUNCTION,
write_callback)) != CURLE_OK ||
- (ret = curl_easy_perform(handle)) != CURLE_OK) {
- curl_easy_cleanup(handle);
- mnstr_destroy(s);
- if (errbuf[0] == 0)
- snprintf(errbuf, CURL_ERROR_SIZE, "%s",
curl_easy_strerror(ret));
- return NULL;
- }
- curl_easy_cleanup(handle);
- (void) mnstr_get_buffer(s); /* switch to read-only */
- return s;
-}
+#include "curl-stream.h"
#endif
struct privdata {
diff --git a/clients/mapiclient/mhelp.h b/clients/mapiclient/mhelp.h
--- a/clients/mapiclient/mhelp.h
+++ b/clients/mapiclient/mhelp.h
@@ -8,4 +8,6 @@
* For copyright information, see the file debian/copyright.
*/
+#include "stream.h"
+
extern void sql_help(const char *pattern, stream *toConsole, int pagewidth);
diff --git a/clients/mapiclient/msqldump.h b/clients/mapiclient/msqldump.h
--- a/clients/mapiclient/msqldump.h
+++ b/clients/mapiclient/msqldump.h
@@ -8,6 +8,9 @@
* For copyright information, see the file debian/copyright.
*/
+#include "mapi.h"
+#include "stream.h"
+
extern int describe_sequence(Mapi mid, const char *schema, const char *sname,
stream *toConsole);
extern int describe_schema(Mapi mid, const char *sname, stream *toConsole);
extern int dump_table(Mapi mid, const char *schema, const char *tname, stream
*sqlf, const char *ddir, const char *ext, bool describe, bool foreign, bool
useInserts, bool databaseDump, bool noescape, bool percent);
diff --git a/clients/mapilib/mapi.h b/clients/mapilib/mapi.h
--- a/clients/mapilib/mapi.h
+++ b/clients/mapilib/mapi.h
@@ -72,6 +72,10 @@ extern "C" {
#ifndef __attribute__
#define __attribute__(...)
#endif
+#else
+#if !__has_attribute(__nonnull__)
+#define __nonnull__(...)
+#endif
#endif
/* connection-oriented functions */
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
@@ -8,7 +8,7 @@
* For copyright information, see the file debian/copyright.
*/
-#include "msettings.h"
+#include "monetdb_config.h"
#ifdef HAVE_UNISTD_H
# include <unistd.h>
@@ -48,6 +48,8 @@
#include <openssl/ssl.h>
#endif
+#include "msettings.h"
+#include "stream.h"
/* Copied from gdk_posix, but without taking a lock because we don't have
access to
* MT_lock_set/unset here. We just have to hope for the best
diff --git a/clients/mapilib/msettings.h b/clients/mapilib/msettings.h
--- a/clients/mapilib/msettings.h
+++ b/clients/mapilib/msettings.h
@@ -12,6 +12,7 @@
#define _MSETTINGS_H 1
#include "mapi.h"
+#include <assert.h>
#include <stdbool.h>
#define MP__BOOL_START (100)
diff --git a/clients/mapilib/msettings_internal.h
b/clients/mapilib/msettings_internal.h
--- a/clients/mapilib/msettings_internal.h
+++ b/clients/mapilib/msettings_internal.h
@@ -11,6 +11,7 @@
#ifndef MSETTINGS_INTERNAL
#define MSETTINGS_INTERNAL
+#include "monetdb_config.h"
#include "msettings.h"
extern const char MALLOC_FAILED[];
@@ -138,9 +139,7 @@ msettings_strdup(const msettings *mp, co
}
-static inline char* msettings_allocprintf(const msettings *mp, _In_z_
_Printf_format_string_ const char *fmt, ...)
- __attribute__((__format__(__printf__, 2, 3)));
-
+__attribute__((__format__(__printf__, 2, 3)))
static inline char*
msettings_allocprintf(const msettings *mp, const char *fmt, ...)
{
diff --git a/sql/test/BugTracker-2026/Tests/7989-window-avg-bug.test
b/sql/test/BugTracker-2026/Tests/7989-window-avg-bug.test
new file mode 100644
--- /dev/null
+++ b/sql/test/BugTracker-2026/Tests/7989-window-avg-bug.test
@@ -0,0 +1,66 @@
+query IRR rowsort
+WITH t AS (
+ SELECT value AS id, CAST(value - 1 AS DOUBLE) AS v
+ FROM generate_series(1, 18)
+)
+SELECT id,
+ AVG(v) OVER (
+ ORDER BY id
+ ROWS BETWEEN 16 PRECEDING AND CURRENT ROW
+ ) AS actual,
+ (SELECT AVG(r.v) FROM t AS r WHERE r.id <= t.id) AS expected
+FROM t
+ORDER BY id
+----
+1
+0.000
+0.000
+10
+4.500
+4.500
+11
+5.000
+5.000
+12
+5.500
+5.500
+13
+6.000
+6.000
+14
+6.500
+6.500
+15
+7.000
+7.000
+16
+7.500
+7.500
+17
+8.000
+8.000
+2
+0.500
+0.500
+3
+1.000
+1.000
+4
+1.500
+1.500
+5
+2.000
+2.000
+6
+2.500
+2.500
+7
+3.000
+3.000
+8
+3.500
+3.500
+9
+4.000
+4.000
+
diff --git a/sql/test/BugTracker-2026/Tests/7990-rank-filter-bug.test
b/sql/test/BugTracker-2026/Tests/7990-rank-filter-bug.test
new file mode 100644
--- /dev/null
+++ b/sql/test/BugTracker-2026/Tests/7990-rank-filter-bug.test
@@ -0,0 +1,46 @@
+-- query without the WHERE r <= 1 works fine
+query III rowsort
+WITH t(id,x) AS (
+ VALUES (1,10), (2,10), (3,20), (4,30)
+)
+SELECT id, x, r
+FROM (
+ SELECT id, x, RANK() OVER (ORDER BY x) AS r
+ FROM t
+) AS s
+-- WHERE r <= 1
+ORDER BY id
+----
+1
+10
+1
+2
+10
+1
+3
+20
+3
+4
+30
+4
+
+-- query with the WHERE r <= 1 works incorrect (removes row {2,10,1})
+query III rowsort
+WITH t(id,x) AS (
+ VALUES (1,10), (2,10), (3,20), (4,30)
_______________________________________________
checkin-list mailing list -- [email protected]
To unsubscribe send an email to [email protected]