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 1iX0tq-0002Bw-9R for pgsql-bugs@arkaria.postgresql.org; Tue, 19 Nov 2019 10:38:22 +0000 Received: from localhost ([127.0.0.1] helo=malur.postgresql.org) by malur.postgresql.org with esmtp (Exim 4.89) (envelope-from ) id 1iX0to-0003dG-N9 for pgsql-bugs@arkaria.postgresql.org; Tue, 19 Nov 2019 10:38:20 +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 1iX0to-0003d8-C4 for pgsql-bugs@lists.postgresql.org; Tue, 19 Nov 2019 10:38:20 +0000 Received: from mail-wr1-x443.google.com ([2a00:1450:4864:20::443]) by makus.postgresql.org with esmtps (TLS1.3:ECDHE_RSA_AES_128_GCM_SHA256:128) (Exim 4.92) (envelope-from ) id 1iX0tl-0003nS-7B for pgsql-bugs@lists.postgresql.org; Tue, 19 Nov 2019 10:38:19 +0000 Received: by mail-wr1-x443.google.com with SMTP id w9so23211422wrr.0 for ; Tue, 19 Nov 2019 02:38:16 -0800 (PST) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=2ndquadrant-com.20150623.gappssmtp.com; s=20150623; h=date:from:to:cc:subject:message-id:references:mime-version :content-disposition:in-reply-to; bh=xyLoHIpxQmjNTSk46idHjrpfSEaBjlsn+2K6FWiVDdc=; b=LgKOS7rDx5N+bMVJ69hRE5gR7bDFIQiNR2B9H6rZoUv54SdoreynaCsiM32TlO9ezC PL/1Mw29knF4BFc3ziLh+igvfuofKXx28qdP/VRMJVS5qv6BKP5HVp3zqaN67N/sy+Wx y2aePLeBvyINqKvas9PFSCAjs1xsY5oD1qcGCUp+3z7zeE0NwSm8b4bCZ0sw8Q+bxqiS HIBCCS14Y1yD+Kap/IwSmHimnnb3zkJ/E/aXye2qTdoMqmlSwfKbbKTf97SCMeiRUayM abmpBFf4kUhFPi1q+ytseuKblLdY4l9nHV6mpotzskylWEBIC2ZvgHZ7HaRUlE6lQfki gHog== X-Google-DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=1e100.net; s=20161025; h=x-gm-message-state:date:from:to:cc:subject:message-id:references :mime-version:content-disposition:in-reply-to; bh=xyLoHIpxQmjNTSk46idHjrpfSEaBjlsn+2K6FWiVDdc=; b=tZSOl3XsfsKspszfiG5APCyG5KOPBGH1C7+SvgUz0UnQk2kIYTgRrXLybJsv/kJiJc jhDdxsOCkQ/+HAc8DDVbbcwlzIDUSz7V9XMGYkbjrZWd4o3tAVtuR8rXiswVgdM4IS6u cpBEtNghpjE13Exf0zxktE/NiV5wwHjsGDSdl9GTM7Ig4hox1jbKz07njYlala7/iOIQ R+yZ8SX4CnvXsUg60qCTVfMlLN+mhNu0wbfwQieL/4XB5yAZmhKiV1DhQKs8vN4xL1Wh 1UBuA6021ENVs4qcUjvCo/LSBFmmtGo36FzABq8kPZ6UDQwmkA50N1JbMzeB0rXQVPiz gEqw== X-Gm-Message-State: APjAAAVbdyUW/6PUhLD/tVfhSO8HiqIDoE1MJipXVgg0/KYmx9woYnN/ RF44Z1YerL05X1AoCPzOYgPJ/OrPPtk= X-Google-Smtp-Source: APXvYqzLRMQReVmZg7s8AEJKGGPxzOj3G4C94W+MViAYeTozuMON7Z/WgN7JHb/ALPRk50Zzw3XLTQ== X-Received: by 2002:a5d:4c8c:: with SMTP id z12mr22092924wrs.347.1574159895531; Tue, 19 Nov 2019 02:38:15 -0800 (PST) Received: from localhost (ip-86-49-253-92.net.upcbroadband.cz. [86.49.253.92]) by smtp.gmail.com with ESMTPSA id b3sm2709762wmh.17.2019.11.19.02.38.14 (version=TLS1_3 cipher=TLS_AES_256_GCM_SHA384 bits=256/256); Tue, 19 Nov 2019 02:38:14 -0800 (PST) Date: Tue, 19 Nov 2019 11:38:13 +0100 From: Tomas Vondra To: Michael Paquier Cc: Adam Scott , pgsql-bugs@lists.postgresql.org Subject: Re: BUG #16122: segfault pg_detoast_datum (datum=0x0) at fmgr.c:1833 numrange query Message-ID: <20191119103813.xnsloisoxkwrxoim@development> References: <16122-eb35bc248c806c15@postgresql.org> <20191118120312.cblcswef6vuqbijq@development> <20191119014827.GC1614@paquier.xyz> MIME-Version: 1.0 Content-Type: text/plain; charset=us-ascii; format=flowed Content-Disposition: inline In-Reply-To: <20191119014827.GC1614@paquier.xyz> List-Id: List-Help: List-Subscribe: List-Post: List-Owner: List-Archive: Precedence: bulk On Tue, Nov 19, 2019 at 10:48:27AM +0900, Michael Paquier wrote: >On Mon, Nov 18, 2019 at 03:59:14PM -0800, Adam Scott wrote: >> It was bugging out with an empty table but it seems intermittent. A >> successful query followed by the one above will not fail sometimes; hence >> the need for a from-scratch startup instance of postgres. > >Okay, that has proved to help a lot. I have restored the dump, and >after an analyze on natica_hdu_test I can see the failure >immediately. > >I have also extracted a small test case able to reproduce the failure. >That's actually pretty close to the scenarios I was playing with >upthread, still I missed it: >CREATE TABLE rangetab (a numrange); >INSERT INTO rangetab >SELECT ('['|| (45.0 - a::numeric/10000000) || ',' || > (45.1 + a::numeric/10000000) || ')')::numrange >FROM generate_series(1,1000) as a; >ANALYZE rangetab; >SELECT a FROM rangetab > WHERE a <@ '[89.9999998611111,90.0000001388889)'; > >I can easily reproduce the failure on HEAD, REL_12_STABLE and >REL_11_STABLE. On 10, I could not. But now that we have a test case >that's only a matter of time. FWIW I've managed to reproduce this on 10, but I had to build without --enable-cassert. So this does trigger the issue: $ ./configure --enable-debug --prefix=/home/user/pg-10 $ make -s clean $ make -s -j8 install $ pg_ctl -D /tmp/data init $ pg_ctl -D /tmp/data -l pg.log start $ createdb test $ psql test < bug.sql $ pgbench -n -c 1 -f q.sql test where q.sql is simply select id from natica_hdu_test WHERE "dec_range" <@ '[88.9999998611111,90.0000001388889)'; Haven't investigated further yet. regards -- Tomas Vondra http://www.2ndQuadrant.com PostgreSQL Development, 24x7 Support, Remote DBA, Training & Services