Re: general purpose array_sort - Mailing list pgsql-hackers

From jian he
Subject Re: general purpose array_sort
Date
Msg-id CACJufxFYuju=dE4DZe_nDL94cHdY7YUurDKSAr96hWzA8dZjgA@mail.gmail.com
Whole thread Raw
In response to Re: general purpose array_sort  (Junwang Zhao <zhjwpku@gmail.com>)
List pgsql-hackers
On Tue, Nov 5, 2024 at 8:30 PM Junwang Zhao <zhjwpku@gmail.com> wrote:
>
>
> Thanks for the bounds preserve solution, I just looked at 0002,
>
> + if (astate->arraystate != NULL)
> + {
> + memcpy(astate->arraystate->dims, dims, ndim * sizeof(int));
> + memcpy(astate->arraystate->lbs, lbs, ndim * sizeof(int));
> + Assert(ndim == astate->arraystate->ndims);
> + }
>
> It seems to me we only need to set astate->arraystate->lbs[0] = lbs[0] ?
>
yes.

> + memcpy(astate->arraystate->dims, dims, ndim * sizeof(int));
thinking about it, this is wrong. we should just do Assert
        for(int i = 0; i < ndim; i++)
        {
            Assert(astate->arraystate->dims[i] == dims[i]);
        }

or just remove
 memcpy(astate->arraystate->dims, dims, ndim * sizeof(int));



pgsql-hackers by date:

Previous
From: jian he
Date:
Subject: can_partial_agg use root->processed_groupClause instead of parse->groupClause
Next
From: RECHTÉ Marc
Date:
Subject: Logical replication timeout