Received: from maia.hub.org (maia-5.hub.org [200.46.204.29]) by mail.postgresql.org (Postfix) with ESMTP id 80C22133740B for ; Mon, 17 Jan 2011 14:17:14 -0400 (AST) Received: from mail.postgresql.org ([200.46.204.86]) by maia.hub.org (mx1.hub.org [200.46.204.29]) (amavisd-maia, port 10024) with ESMTP id 54394-07 for ; Mon, 17 Jan 2011 18:17:07 +0000 (UTC) X-Greylist: from auto-whitelisted by SQLgrey-1.7.6 Received: from sss.pgh.pa.us (sss.pgh.pa.us [66.207.139.130]) by mail.postgresql.org (Postfix) with ESMTP id D83E213364DE for ; Mon, 17 Jan 2011 14:17:06 -0400 (AST) Received: from sss2.sss.pgh.pa.us (tgl@localhost [127.0.0.1]) by sss.pgh.pa.us (8.14.2/8.14.2) with ESMTP id p0HIH32I016836; Mon, 17 Jan 2011 13:17:03 -0500 (EST) To: "Karsten Loesing" cc: pgsql-bugs@postgresql.org Subject: Re: BUG #5840: Updating arrays using subscripted assignment results in uninitialized values In-reply-to: <201101151712.p0FHCBvS019298@wwwmaster.postgresql.org> References: <201101151712.p0FHCBvS019298@wwwmaster.postgresql.org> Comments: In-reply-to "Karsten Loesing" message dated "Sat, 15 Jan 2011 17:12:11 +0000" Date: Mon, 17 Jan 2011 13:17:03 -0500 Message-ID: <16835.1295288223@sss.pgh.pa.us> From: Tom Lane X-Virus-Scanned: Maia Mailguard 1.0.1 X-Spam-Status: No, hits=-1.91 tagged_above=-5 required=5 tests=BAYES_00=-1.9, T_RP_MATCHES_RCVD=-0.01 X-Spam-Level: X-Archive-Number: 201101/126 X-Sequence-Number: 29148 "Karsten Loesing" 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