Skip to content

Commit

Permalink
PG16 got stricter about Datum vs. Pointer (#27)
Browse files Browse the repository at this point in the history
PG16 got stricter about Datum vs. Pointer

The compilation for tdigest got stricter with postgres 16, especially on shadowing variables.
Therefore we need to undo the shadowing of `mean` and `i`.
After some analysis the shadowing turned out to be 'useless' and thus the lines are removed.

Close #25.

---------

Co-authored-by: Nils Dijk <[email protected]>
  • Loading branch information
df7cb and thanodnl authored Sep 22, 2023
1 parent e6688b4 commit 8ba27e0
Show file tree
Hide file tree
Showing 2 changed files with 3 additions and 5 deletions.
2 changes: 1 addition & 1 deletion .github/workflows/ci.yml
Original file line number Diff line number Diff line change
Expand Up @@ -4,7 +4,7 @@ jobs:
test:
strategy:
matrix:
pg: [15, 14, 13, 12, 11, 10, 9.6]
pg: [16, 15, 14, 13, 12, 11, 10, 9.6]
name: PostgreSQL ${{ matrix.pg }}
runs-on: ubuntu-latest
container: pgxn/pgxn-tools
Expand Down
6 changes: 2 additions & 4 deletions tdigest.c
Original file line number Diff line number Diff line change
Expand Up @@ -2659,7 +2659,6 @@ tdigest_in(PG_FUNCTION_ARGS)
/* the centroids should be sorted by mean */
if (i > 0)
{
double mean = digest->centroids[i].mean;
double mean_prev = digest->centroids[i-1].mean;

if (!(flags & TDIGEST_STORES_MEAN))
Expand Down Expand Up @@ -3058,7 +3057,6 @@ tdigest_add_double_count_trimmed(PG_FUNCTION_ARGS)
*/
if (count > BUFFER_SIZE(state->compression))
{
int i;
tdigest_t *new;
double value = PG_GETARG_FLOAT8(1);

Expand Down Expand Up @@ -3417,6 +3415,6 @@ double_to_array(FunctionCallInfo fcinfo, double *d, int len)
CurrentMemoryContext);
}

PG_RETURN_ARRAYTYPE_P(makeArrayResult(astate,
CurrentMemoryContext));
PG_RETURN_ARRAYTYPE_P(DatumGetPointer(makeArrayResult(astate,
CurrentMemoryContext)));
}

0 comments on commit 8ba27e0

Please sign in to comment.