Switch branches/tags
Nothing to show
Commits on Aug 22, 2016
  1. fix: don't pfree() state2 in combine function

    Currently this works as we only combine the states once, but once we
    start using the same infrastructure for grouping sets etc. it would
    start crashing.
    committed Aug 22, 2016
Commits on Aug 13, 2016
  1. stamp 2.0.0

    This also includes upgrade script from 1.3.3, the current version
    in 1.3 stable branch.
    committed Aug 13, 2016
  2. fix 'value overflows numeric format' error in numeric aggregates

    The numeric aggregates with numerator (N*sumX2 - sumX*sumX) were
    failing with this strange error
        ERROR:  value overflows numeric format
    when evaluating the numerator. Not sure what exactly is the cause,
    but getting rid of the numerator fixed it.
    Also, get rid of the const_zero idea and simply return new value
    every time we hit the round-off condition (which should not be
    very common). People may do pfree() on the result, which would
    immediately break the const_zero value.
    committed Aug 13, 2016
  3. fix: don't assume _combine_ only sees sorted states, enforce the sorting

    The _combine_ may actually see unsorted states, as the leader does not
    serialize/deserialize the local state.
    committed Aug 13, 2016
  4. add sort_state_* functions wrapping the pg_qsort calls

    For double, int32 and int64 this is fairly straightforward, but
    for Numeric it requires reordering data in the buffer (in-place).
    This also allows removal of build_numeric_elements() function,
    and instead read the data directly from the buffer. The code is
    a bit more complicated as we need to skip some elements, though.
    committed Aug 13, 2016
  5. handle negative numerators in STDDEV/VAR final functions

    It can happen that due to round-off errors, we get
        N * sum(X*X) - sum(X)*sum(X) < 0
    In those cases we must not use this to compute the VAR/STDDEV
    estimates, and instead return 0.
    For the NUMERIC data type, we use a global static variable
    const_zero, so that we don't have to recompute it over and over.
    committed Aug 13, 2016
  6. add asserts to various functions

    committed Aug 13, 2016
  7. minor refactoring / reformatting in the serial functions

    Reorganize the code so that related things happen closer, and also
    fix some formatting issues due to past rename of variables.
    committed Aug 13, 2016
  8. when both state and value are NULL, _append_ can return NULL directly

    This is a minor optimization - we don't allocate state until we get
    the first non-NULL element. So at the beginning of the append function
    we simply do
        if (PG_ARGISNULL(0) && PG_ARGISNULL(1))
    This check was already there for NUMERIC, this commit also adds it
    to the other data types (INT, BIGINT, DOUBLE PRECISION), and changes
    the comment a bit.
    committed Aug 13, 2016
  9. remove obsolete comment about 'dirty trick' with passing pointers

    This is actually the whole point of 'internal' data type, so it's
    expected and not dirty at all.
    committed Aug 13, 2016
  10. sort the data before serialization, then merge (numeric)

    This reworks the state_numeric - instead of (Numeric*) array with
    pointers to the Numeric values, we keep just a buffer with copies
    of the data. We need the buffers, and we need to repalloc() them
    in _append_ methods, which however invalidates the pointers. And
    we only need the pointers for sorting, so instead of maintaining
    them all the time, we simply build them ad-hoc.
    committed Aug 13, 2016
Commits on Aug 12, 2016
  1. fix from/to condition to return NULL

    So far it was (from > to), but (from >= to) seems more appropriate.
    committed Aug 12, 2016