Received: from malur.postgresql.org ([217.196.149.56]) by arkaria.postgresql.org with esmtps (TLS1.3:ECDHE_RSA_AES_256_GCM_SHA384:256) (Exim 4.92) (envelope-from ) id 1miled-00081r-VT for pgsql-hackers@arkaria.postgresql.org; Thu, 04 Nov 2021 22:56:20 +0000 Received: from localhost ([127.0.0.1] helo=malur.postgresql.org) by malur.postgresql.org with esmtp (Exim 4.92) (envelope-from ) id 1milec-0001Ck-Am for pgsql-hackers@arkaria.postgresql.org; Thu, 04 Nov 2021 22:56:18 +0000 Received: from makus.postgresql.org ([2001:4800:3e1:1::229]) by malur.postgresql.org with esmtps (TLS1.3:ECDHE_RSA_AES_256_GCM_SHA384:256) (Exim 4.92) (envelope-from ) id 1mileb-0001Ca-MB for pgsql-hackers@lists.postgresql.org; Thu, 04 Nov 2021 22:56:18 +0000 Received: from mail-ed1-x536.google.com ([2a00:1450:4864:20::536]) by makus.postgresql.org with esmtps (TLS1.3:ECDHE_RSA_AES_128_GCM_SHA256:128) (Exim 4.92) (envelope-from ) id 1mileY-0000Ar-JX for pgsql-hackers@postgresql.org; Thu, 04 Nov 2021 22:56:16 +0000 Received: by mail-ed1-x536.google.com with SMTP id w1so26969639edd.10 for ; Thu, 04 Nov 2021 15:56:14 -0700 (PDT) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=enterprisedb.com; s=google; h=message-id:date:mime-version:user-agent:subject:content-language:to :cc:references:from:in-reply-to:content-transfer-encoding; bh=fR07oIGTwH1F5J4xr8H4neZq2Tgb77l5H/PS2p4XZvg=; b=Bgu14coYOMnhexGm7eHg7U3CR+9Pm8HNYw0agAjxroQvkgP1ld6t1MSivh2T/TJ++i wtjBJ87G0s19sCFNlzs6XTmfqdOFhHJY6Vgc/4aX9B+hdWt40CE95U11RbnnYG1wulNs M0KpiZgBylEe/zVVaYSfvC/LqxPMIKfxnOsTA97pTzPkbrMbUd03pm7mh6xbopWkGY3g 5TU7Ynt9JPF7MgxCqLj3IV9OJTxBTTZrgCIyGDfxqBqIG9n01V+LgG1iwKgRTkJGhAfW hORMf5TIAO6LvdN8q7wh0uIV8dBsqo2pP6lG0klExx9K8wP0ArOvYbYYBjDZpPXYheXx tDnA== X-Google-DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=1e100.net; s=20210112; h=x-gm-message-state:message-id:date:mime-version:user-agent:subject :content-language:to:cc:references:from:in-reply-to :content-transfer-encoding; bh=fR07oIGTwH1F5J4xr8H4neZq2Tgb77l5H/PS2p4XZvg=; b=r4RI6Eln1TOk22fReenqGiTIgxVyQKHbPYeoOODfMGydlHMknRHav8hOf6TJrK39Ut A1Pro4lHAb/9tWyJW4QJ0sIustGIj5WK2xbJt/7wpHuoxTgWb/o7SKDe+tA5Q4gIMYQF BOmu9/UIs6hTLTrtimu9JSC8qkzNURjlA4cmqsquJ4mArGAwHNaQy+eqatEJn5vdQ5MU dfXFtFjxbWVgbADx2+66MYAl66zQzSOnu3z/zJcUNDBDUk7fA0xFi/4wCtz1jzXzLzKU 58Arr8lbctMGgdo2pOgTzVBxDTsnSVVykspH1neP1mDnTGuP8A7F2sd9WGudfl1lLrlD lYWQ== X-Gm-Message-State: AOAM531tLkS/iyLIyBFcziybG3lgXfiFvkSnVbbnP/6MW2XKfHXxAdKM klOxz0HSa1TAedb0Q+3sdEkXqb6g/INXT8xkgimZwP7Zjo13At99blcRcGcw15JQiOUW1uBF3Eh /zJTugkxW0XAoJVLYV6tijKxP0Ex1lE6D5TzKB05NCxxCvFvhoqcdpOC/MwFdFMFm9WoKzZxbsq 3MrrkeKD/ck57YUD7hm0kMf3HBXpqGLM0pcO+f X-Google-Smtp-Source: ABdhPJwf1rBDNISflETexqtU94pkT+ffm7pYyqHwZNc2SsKCgRU+EOQkJMA9gGxl3V/2doIJVCINLA== X-Received: by 2002:a17:906:2606:: with SMTP id h6mr68153909ejc.301.1636066572669; Thu, 04 Nov 2021 15:56:12 -0700 (PDT) Received: from [10.137.0.18] (ip-86-49-251-104.net.upcbroadband.cz. [86.49.251.104]) by smtp.gmail.com with ESMTPSA id r16sm3136328ejj.89.2021.11.04.15.56.12 (version=TLS1_3 cipher=TLS_AES_128_GCM_SHA256 bits=128/128); Thu, 04 Nov 2021 15:56:12 -0700 (PDT) Message-ID: <83b2e911-ccd9-5503-fb32-369050a6e93d@enterprisedb.com> Date: Thu, 4 Nov 2021 23:56:07 +0100 MIME-Version: 1.0 User-Agent: Mozilla/5.0 (X11; Linux x86_64; rv:91.0) Gecko/20100101 Thunderbird/91.1.0 Subject: Re: [sqlsmith] Failed assertion in brin_minmax_multi_distance_float4 on REL_14_STABLE Content-Language: en-US To: Justin Pryzby , Andreas Seltenreich Cc: pgsql-hackers@postgresql.org, Jaime Casanova References: <87r1bw9ukm.fsf@credativ.de> <20211104165357.GU17618@telsasoft.com> From: Tomas Vondra In-Reply-To: <20211104165357.GU17618@telsasoft.com> Content-Type: text/plain; charset=UTF-8; format=flowed Content-Transfer-Encoding: 7bit X-CLOUD-SEC-AV-Info: enterprisedb,google_mail,monitor X-CLOUD-SEC-AV-Sent: true X-Gm-Spam: 0 X-Gm-Phishy: 0 List-Id: List-Help: List-Subscribe: List-Post: List-Owner: List-Archive: Archived-At: Precedence: bulk Hi, On 11/4/21 17:53, Justin Pryzby wrote: > On Thu, Nov 04, 2021 at 09:46:49AM +0100, Andreas Seltenreich wrote: >> sqlsmith triggers the following assertion when testing REL_14_STABLE: >> >> TRAP: FailedAssertion("a1 <= a2", File: "brin_minmax_multi.c", Line: 1879, PID: 631814) >> >> I can reproduce it with the following query on a fresh regression >> database: >> >> insert into public.brintest_multi (float4col) values (real 'nan'); >> >> The branch was at f6162c020c while testing, backtrace below. > > I couldn't reproduce this, but it reminds me of this one, which we also had > trouble reproducing. > I can reproduce that just fine - all I had to do was 'make installcheck' and then connect to the regression db and run the insert. It seems to be a simple case of confusion in handling of NaN values. We do sort them correctly (by calling float4_lt), but given two values arg1 = nan (0x400000) arg2 = 0.0909090936 then a simple comparison does not give the expected result (arg1 < arg2) (arg1 == arg2) (arg1 > arg2) all evaluate to false, which is why the assert fails. So I guess the distance function for float4 (and probably float8 too) need a couple more lines checking NaN. regards -- Tomas Vondra EnterpriseDB: http://www.enterprisedb.com The Enterprise PostgreSQL Company