From: Tom Lane <tgl@sss.pgh.pa.us>
To: Paul B. Anderson <paul.a@pnlassociates.com>
Cc: pgsql-admin@postgresql.org
Cc: pgsql-general@postgresql.org
Cc: pgsql-hackers@postgresql.org
Subject: Array assignment behavior (was Re: Stored procedure array limits)
Date: Fri, 29 Sep 2006 12:14:11 -0400
Message-ID: <16926.1159546451@sss.pgh.pa.us> (raw)
In-Reply-To: <451D37C8.8060502@pnlassociates.com>
References: <451C48AB.6090508@pnlassociates.com>
<9461.1159502232@sss.pgh.pa.us>
<451D34FD.3050709@pnlassociates.com>
<451D37C8.8060502@pnlassociates.com>
[ expanding this thread, as it now needs wider discussion ]
"Paul B. Anderson" <paul.a@pnlassociates.com> writes:
> Actually, I was not filling all of the arrays in sequential order. I
> added code to initialize them in order and the function seems to be
> working now. Is that a known problem?
Well, it's a documented behavior: section 8.10.4 saith
A stored array value can be enlarged by assigning to an element
adjacent to those already present, or by assigning to a slice
that is adjacent to or overlaps the data already present.
Up to 8.2 we didn't have a lot of choice about this, because without any
ability to have nulls embedded in arrays, there wasn't any sane thing to
do with the intermediate positions if you assigned to an element not
adjacent to the existing range. As of 8.2 we could allow assignment to
arbitrary positions by filling the intermediate positions with nulls.
The code hasn't actually been changed to allow that, but it's something
we could consider doing now.
Comments?
regards, tom lane
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-admin@postgresql.org
Cc: tgl@sss.pgh.pa.us, paul.a@pnlassociates.com, pgsql-general@postgresql.org, pgsql-hackers@postgresql.org
Subject: Re: Array assignment behavior (was Re: Stored procedure array limits)
In-Reply-To: <16926.1159546451@sss.pgh.pa.us>
References: <451C48AB.6090508@pnlassociates.com> <9461.1159502232@sss.pgh.pa.us> <451D34FD.3050709@pnlassociates.com> <451D37C8.8060502@pnlassociates.com> <16926.1159546451@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