Received: from malur.postgresql.org ([217.196.149.56]) by arkaria.postgresql.org with esmtps (TLS1.2:ECDHE_RSA_AES_256_CBC_SHA1:256) (Exim 4.89) (envelope-from ) id 1izAKG-0004xj-Iw for pgsql-bugs@arkaria.postgresql.org; Wed, 05 Feb 2020 02:22:00 +0000 Received: from localhost ([127.0.0.1] helo=malur.postgresql.org) by malur.postgresql.org with esmtp (Exim 4.89) (envelope-from ) id 1izAKF-0006QA-7R for pgsql-bugs@arkaria.postgresql.org; Wed, 05 Feb 2020 02:21:59 +0000 Received: from magus.postgresql.org ([2a02:c0:301:0:ffff::29]) by malur.postgresql.org with esmtps (TLS1.2:ECDHE_RSA_AES_256_CBC_SHA1:256) (Exim 4.89) (envelope-from ) id 1izAKE-0006Q3-Vt for pgsql-bugs@lists.postgresql.org; Wed, 05 Feb 2020 02:21:59 +0000 Received: from relay11.mail.gandi.net ([217.70.178.231]) by magus.postgresql.org with esmtps (TLS1.2:ECDHE_RSA_AES_256_GCM_SHA384:256) (Exim 4.92) (envelope-from ) id 1izAKC-00026J-Kw for pgsql-bugs@lists.postgresql.org; Wed, 05 Feb 2020 02:21:58 +0000 Received: from [10.8.8.11] (unknown [185.94.189.190]) (Authenticated sender: vik@postgresfriends.org) by relay11.mail.gandi.net (Postfix) with ESMTPSA id 6A454100002; Wed, 5 Feb 2020 02:21:54 +0000 (UTC) Subject: Re: BUG #16242: convert_tuple_* not handling missing values correctly To: Andres Freund Cc: andrew@tao11.riddles.org.uk, pgsql-bugs@lists.postgresql.org References: <16242-d1c9fca28445966b@postgresql.org> <31edb400-f065-73c4-7b1f-2953ad3413e6@postgresfriends.org> <20200205021933.c4wtkpcx2li3um2k@alap3.anarazel.de> From: Vik Fearing Message-ID: <3c396c9e-960f-9c03-63b7-d58e0e044fba@postgresfriends.org> Date: Wed, 5 Feb 2020 03:21:52 +0100 User-Agent: Mozilla/5.0 (X11; Linux x86_64; rv:68.0) Gecko/20100101 Thunderbird/68.4.1 MIME-Version: 1.0 In-Reply-To: <20200205021933.c4wtkpcx2li3um2k@alap3.anarazel.de> Content-Type: text/plain; charset=utf-8 Content-Language: en-US Content-Transfer-Encoding: 7bit List-Id: List-Help: List-Subscribe: List-Post: List-Owner: List-Archive: Precedence: bulk On 05/02/2020 03:19, Andres Freund wrote: > On 2020-02-05 03:03:04 +0100, Vik Fearing wrote: >> On 04/02/2020 03:24, PG Bug reporting form wrote: >>> The following example shows a tuple appearing with NULLs in a column >>> declared NOT NULL, because there is a missing default value not being filled >>> in. The cause is that convert_tuples_by_name, or more precisely >>> check_attrmap_match, thinks that it's enough for the tupdescs to match up as >>> regards attnums/names/types, without considering that the source tupdesc >>> might have missing values that the destination does not. So it incorrectly >>> concludes that no conversion is needed, and the missing values become >>> null. >> >> Here is a quick patch that fixes this on master. > > Should include a regression test... That's what I thought, too. Where should I put it? -- Vik Fearing