Skip site navigation (1) Skip section navigation (2)

Re: BUG #5840: Updating arrays using subscripted assignment results in uninitialized values

From: Tom Lane <tgl(at)sss(dot)pgh(dot)pa(dot)us>
To: "Karsten Loesing" <karsten(dot)loesing(at)gmx(dot)net>
Cc: pgsql-bugs(at)postgresql(dot)org
Subject: Re: BUG #5840: Updating arrays using subscripted assignment results in uninitialized values
Date: 2011-01-17 18:17:03
Message-ID: 16835.1295288223@sss.pgh.pa.us (view raw or flat)
Thread:
Lists: pgsql-bugs
"Karsten Loesing" <karsten(dot)loesing(at)gmx(dot)net> writes:
> Modifying an array as described in
> http://www.postgresql.org/docs/8.4/static/arrays.html#ARRAYS-MODIFYING
> sometimes leads to uninitialized values.  See the following example:

> CREATE TABLE test_array (my_array BIGINT[]);
> INSERT INTO test_array (my_array) VALUES ('[40:41]={40,41}');
> UPDATE test_array SET my_array[1:2]='{1,2}';
> SELECT * FROM test_array;

They're not actually "uninitialized"; the correct values are inserted,
but then overwritten with garbage.  This seems to have been broken since
8.2 :-(.  Fix committed:
http://git.postgresql.org/gitweb?p=postgresql.git;a=commitdiff;h=f43c4d9ec4d46e4d664af4c1a2a6345921a353fb

Thanks for the report!

			regards, tom lane

In response to

pgsql-bugs by date

Next:From: Tom LaneDate: 2011-01-17 20:57:20
Subject: Re: Problems with adding a is not null to a query.
Previous:From: Robert HaasDate: 2011-01-17 17:11:24
Subject: Re: Problems with adding a is not null to a query.

Privacy Policy | About PostgreSQL
Copyright © 1996-2014 The PostgreSQL Global Development Group