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 1i2yVk-0001vT-5L for pgsql-hackers@arkaria.postgresql.org; Wed, 28 Aug 2019 14:01:20 +0000 Received: from localhost ([127.0.0.1] helo=malur.postgresql.org) by malur.postgresql.org with esmtp (Exim 4.89) (envelope-from ) id 1i2yVj-0007ML-2K for pgsql-hackers@arkaria.postgresql.org; Wed, 28 Aug 2019 14:01:19 +0000 Received: from makus.postgresql.org ([2001:4800:3e1:1::229]) by malur.postgresql.org with esmtps (TLS1.2:ECDHE_RSA_AES_256_CBC_SHA1:256) (Exim 4.89) (envelope-from ) id 1i2yVi-0007Ey-Lw for pgsql-hackers@lists.postgresql.org; Wed, 28 Aug 2019 14:01:18 +0000 Received: from sss.pgh.pa.us ([66.207.139.130]) by makus.postgresql.org with esmtps (TLS1.2:ECDHE_RSA_AES_256_CBC_SHA1:256) (Exim 4.92) (envelope-from ) id 1i2yVg-0000ti-9j for pgsql-hackers@postgresql.org; Wed, 28 Aug 2019 14:01:17 +0000 Received: from sss1.sss.pgh.pa.us (localhost [127.0.0.1]) by sss.pgh.pa.us (8.14.4/8.14.4) with ESMTP id x7SE0xmh031062; Wed, 28 Aug 2019 10:01:00 -0400 From: Tom Lane To: Heikki Linnakangas cc: pgsql-hackers Subject: Re: Crash in BRIN summarization In-reply-to: References: Comments: In-reply-to Heikki Linnakangas message dated "Wed, 28 Aug 2019 12:22:17 +0300" MIME-Version: 1.0 Content-Type: text/plain; charset="us-ascii" Content-ID: <31060.1567000859.1@sss.pgh.pa.us> Content-Transfer-Encoding: quoted-printable Date: Wed, 28 Aug 2019 10:00:59 -0400 Message-ID: <31061.1567000859@sss.pgh.pa.us> List-Id: List-Help: List-Subscribe: List-Post: List-Owner: List-Archive: Precedence: bulk Heikki Linnakangas writes: > I bumped into a little bug in BRIN, while hacking on something = > unrelated. This causes a segfault, or an assertion failure if assertions= = > are enabled: Good catch. > Fix attached. Hm, I don't particularly care for directly comparing Datum values like that. We don't do that elsewhere (I think) and it feels like a type violation to me. Since you've already tested for !attbyval, I think it'd be legitimate to extract the pointer values and compare those, eg if (!attr->attbyval && DatumGetPointer(result) !=3D DatumGetPointer(column->bv_values[INCLUS= ION_UNION])) I realize that this makes no difference in terms of the machine code (at least for most machines?) but it avoids breaking the Datum abstraction. regards, tom lane