From: Tom Lane <tgl@sss.pgh.pa.us>
To: Yury Zhuravlev <u.zhuravlev@postgrespro.ru>
Cc: pgsql-hackers@postgresql.org
Subject: Re: Some questions about the array.
Date: Tue, 22 Dec 2015 21:15:03 -0500
Message-ID: <4475.1450836903@sss.pgh.pa.us> (raw)
In-Reply-To: <dd701b62-008d-4048-882e-20df0e4b59a2@postgrespro.ru>
References: <2987745.PueTkqGxbO@dinodell>
<1538864.xaPm21N10Q@dinodell>
<56619AB0.2070802@sigaev.ru>
<2723429.ZaCixaFn1x@dinodell>
<6ac195fe-b835-4d2d-8edc-11db52118cbf@postgrespro.ru>
<2853.1450718923@sss.pgh.pa.us>
<bfc00a3c-529f-4d1a-895f-388885144d62@postgrespro.ru>
<12549.1450797031@sss.pgh.pa.us>
<dd701b62-008d-4048-882e-20df0e4b59a2@postgrespro.ru>
List-Unsubscribe: <mailto:majordomo@postgresql.org?body=unsub%20pgsql-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
--
Sent via pgsql-hackers mailing list (pgsql-hackers@postgresql.org)
To make changes to your subscription:
http://www.postgresql.org/mailpref/pgsql-hackers
Reply instructions:
You may reply publicly to this message via plain-text email
using any one of the following methods:
* Reply to all the recipients from your mail client; the link fills in
the headers below: reply via email
Some clients, webmail especially, drop In-Reply-To and References from
a link, and the reply then starts a new thread: use the mbox below.
To: pgsql-hackers@postgresql.org
Cc: tgl@sss.pgh.pa.us, u.zhuravlev@postgrespro.ru
Subject: Re: Some questions about the array.
In-Reply-To: <4475.1450836903@sss.pgh.pa.us>
References: <2987745.PueTkqGxbO@dinodell> <1538864.xaPm21N10Q@dinodell> <56619AB0.2070802@sigaev.ru> <2723429.ZaCixaFn1x@dinodell> <6ac195fe-b835-4d2d-8edc-11db52118cbf@postgrespro.ru> <2853.1450718923@sss.pgh.pa.us> <bfc00a3c-529f-4d1a-895f-388885144d62@postgrespro.ru> <12549.1450797031@sss.pgh.pa.us> <dd701b62-008d-4048-882e-20df0e4b59a2@postgrespro.ru> <4475.1450836903@sss.pgh.pa.us>
* Save the following mbox file, import it into your mail client,
and reply-to-all from there: mbox
This inbox is served by DDX for PostgreSQL; see mirroring instructions
for how to clone and mirror all data and code used for this inbox