I respond myself:
Enrico Sirola ha scritto:
[...]
> seems to work). The problem for the code above is that it doesn't work
> for vectors longer than 1000 elements or so (try it with 2000 and it
> doesn't work). I guess I should manage the "toasting" machinery in some
> ways - any suggestion is appreciated
wrong. it was just that I forgot to add ARR_OVERHEAD_NONULLS(ndims1) to
the mem allocation for rv:
rv = (ArrayType *) palloc(nbytes);
becomes
rv = (ArrayType *) palloc(nbytes) + ARR_OVERHEAD_NONULLS(ndims1);
and now it seems to work :)