Changeset: 477c5b6b2157 for MonetDB
URL: https://dev.monetdb.org/hg/MonetDB/rev/477c5b6b2157
Branch: nested
Log Message:
Merge with default branch.
diffs (truncated from 559 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/gdk/gdk_storage.c b/gdk/gdk_storage.c
--- a/gdk/gdk_storage.c
+++ b/gdk/gdk_storage.c
@@ -434,18 +434,19 @@ GDKextend(const char *fn, size_t size)
* The primary concern here is to handle STORE_MMAP and STORE_MEM.
*/
gdk_return
-GDKsave(int farmid, const char *nme, const char *ext, void *buf, size_t size,
storage_t mode, bool dosync)
+GDKsave(int farmid, const char *nme, const char *ext, void *buf, size_t size,
+ storage_t mode, bool dosync)
{
int err = 0;
- TRC_DEBUG(IO, "GDKsave: name=%s, ext=%s, mode %d, dosync=%d\n", nme,
ext ? ext : "", (int) mode, dosync);
+ TRC_DEBUG(IO, "name=%s, ext=%s, mode %d, dosync=%d\n", nme, ext ? ext :
"", (int) mode, dosync);
assert(!GDKinmemory(farmid));
if (mode == STORE_MMAP) {
if (dosync && size && !(ATOMIC_GET(&GDKdebug) & NOSYNCMASK))
err = MT_msync(buf, size);
if (err)
- GDKerror("error on: name=%s, ext=%s, mode=%d\n",
+ GDKerror("msync failed: name=%s, ext=%s, mode=%d\n",
nme, ext ? ext : "", (int) mode);
TRC_DEBUG(IO, "MT_msync(buf %p, size %zu) = %d\n",
buf, size, err);
@@ -466,7 +467,7 @@ GDKsave(int farmid, const char *nme, con
(unsigned) MIN(1 << 30, size));
if (ret < 0) {
err = -1;
- GDKsyserror("GDKsave: error %zd"
+ GDKsyserror("write: error %zd"
" on: name=%s, ext=%s, "
"mode=%d\n", ret, nme,
ext ? ext : "", (int) mode);
@@ -480,7 +481,8 @@ GDKsave(int farmid, const char *nme, con
(unsigned) MIN(1 << 30, size),
ret);
}
- if (dosync && !(ATOMIC_GET(&GDKdebug) & NOSYNCMASK)
+ if (!err && dosync
+ && !(ATOMIC_GET(&GDKdebug) & NOSYNCMASK)
#if defined(NATIVE_WIN32)
&& _commit(fd) < 0
#elif defined(HAVE_FDATASYNC)
@@ -489,7 +491,7 @@ GDKsave(int farmid, const char *nme, con
&& fsync(fd) < 0
#endif
) {
- GDKsyserror("GDKsave: error on: name=%s, "
+ GDKsyserror("sync failed: name=%s, "
"ext=%s, mode=%d\n", nme,
ext ? ext : "", (int) mode);
err = -1;
@@ -499,10 +501,9 @@ GDKsave(int farmid, const char *nme, con
/* do not tolerate corrupt heap images
* (BBPrecover on restart will kill
* them) */
- GDKerror("could not remove: name=%s, "
- "ext=%s, mode %d\n", nme,
- ext ? ext : "", (int) mode);
- return GDK_FAIL;
+ GDKerror("could not remove after error: "
+ "name=%s, ext=%s, mode %d\n",
+ nme, ext ? ext : "", (int) mode);
}
} else {
err = -1;
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
_______________________________________________
checkin-list mailing list -- [email protected]
To unsubscribe send an email to [email protected]