On 17/12/2017 11:40, Lifepillar wrote:
When I call a custom aggregate function on an empty table T, e.g.,
`select myaggr(A) from T`, the sqlite3_aggregate_context() call in the
xFinal callback does not return zeroed out memory, but a block of
seemingly uninitialized memory. Is that expected? If so, how do I know
that the xStep callback has not been called?

The code looks like this:

typedef struct Aggr Aggr;
struct Aggr {
   Value value;
   uint32_t count;
};

static void
myaggrStep(sqlite3_context* ctx, int argc, sqlite3_value** argv) {
   Aggr* sum = (Aggr*)sqlite3_aggregate_context(ctx, sizeof(Aggr*));

Oh dear. Never mind, I have just noticed the spurious pointer.

Sorry for the noise,
Life.

_______________________________________________
sqlite-users mailing list
sqlite-users@mailinglists.sqlite.org
http://mailinglists.sqlite.org/cgi-bin/mailman/listinfo/sqlite-users

Reply via email to