Re: Some questions about the array.

Поиск
Список
Период
Сортировка
От Tom Lane
Тема Re: Some questions about the array.
Дата
Msg-id 4475.1450836903@sss.pgh.pa.us
обсуждение исходный текст
Ответ на Re: Some questions about the array.  (Yury Zhuravlev <u.zhuravlev@postgrespro.ru>)
Ответы Re: Some questions about the array.  (Yury Zhuravlev <u.zhuravlev@postgrespro.ru>)
Список pgsql-hackers
Yury Zhuravlev <u.zhuravlev@postgrespro.ru> writes:
> New patch version in attachment.  

I've committed this with a number of revisions, mostly but not entirely
cosmetic.  Worthy of note:

* I did not like the way you were inserting the replacement subscript
values:

+            arrays = (AnyArrayType *)DatumGetArrayTypeP(array_source);
+            indexexpr = AARR_LBOUND(arrays)[i] + AARR_DIMS(arrays)[i] - 1;

If the source array is toasted, this causes an extra detoast operation
for *each* omitted subscript.  That could be pretty high overhead for
a large array.  The best way to avoid that is to postpone the actual
substitution of the replacement subscript values into array_get_slice
and array_set_slice; which complicates their APIs a bit more, but those
were pretty long argument lists already.

* Having done that, there was no very good reason for the blanket
prohibition on using omitted subscripts in the slice-set case.  We only
really need to fail if we're constructing the array from scratch, when
we don't have any existing subscript limits to substitute.
        regards, tom lane



В списке pgsql-hackers по дате отправления:

Предыдущее
От: Tom Lane
Дата:
Сообщение: Re: Possible marginally-incompatible change to array subscripting
Следующее
От: Tatsuo Ishii
Дата:
Сообщение: pgbench --latency-limit option