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 1lOyeX-0008Q7-Az for pgsql-hackers@arkaria.postgresql.org; Wed, 24 Mar 2021 08:14:09 +0000 Received: from localhost ([127.0.0.1] helo=malur.postgresql.org) by malur.postgresql.org with esmtp (Exim 4.92) (envelope-from ) id 1lOyeW-0000Q5-8I for pgsql-hackers@arkaria.postgresql.org; Wed, 24 Mar 2021 08:14:08 +0000 Received: from magus.postgresql.org ([2a02:c0:301:0:ffff::29]) by malur.postgresql.org with esmtps (TLS1.3:ECDHE_RSA_AES_256_GCM_SHA384:256) (Exim 4.92) (envelope-from ) id 1lOyeV-0000Py-Tv for pgsql-hackers@lists.postgresql.org; Wed, 24 Mar 2021 08:14:08 +0000 Received: from mail-io1-xd2e.google.com ([2607:f8b0:4864:20::d2e]) by magus.postgresql.org with esmtps (TLS1.3:ECDHE_RSA_AES_128_GCM_SHA256:128) (Exim 4.92) (envelope-from ) id 1lOyeU-0006gl-8a for pgsql-hackers@postgresql.org; Wed, 24 Mar 2021 08:14:07 +0000 Received: by mail-io1-xd2e.google.com with SMTP id k8so20566753iop.12 for ; Wed, 24 Mar 2021 01:14:05 -0700 (PDT) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=telsasoft-com.20150623.gappssmtp.com; s=20150623; h=date:from:to:cc:subject:message-id:references:mime-version :content-disposition:in-reply-to:user-agent; bh=zU9cMyUkca4kWvUJVjducHZl2lzeL+xM31Izn39uAw0=; b=wkPf0+84iKlCn++Amu0g4VJPW5xjK9LK9RlLgBsXh1MozcwAMlBcIkUSnwHtbELqMQ f6/FBjyenC82t1qKu9cnLZHVeZkeovqvx4HXRkugmzaI/ihZwrkMWkSPUVKgKFMIldQK ZbA/71g+A1AwRoK+rCZFQFWRHWs1W3eb24XLmmW/IJe3fmrahT3S+0lfgCnFRKofY8yY 6p+OIkgcM5VBUdo8jfCHm0KA/bH2P7PjGVOCx+7XucdP2KJ/ubfciT2W0EXOmlvrH21p bdVfw/QY64RuFcTIt1S0Ajmuoucnf4f9H4qsAtdF/dZup3BW7FfYhX+Pf6zFCUYs0k+y BlDg== 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:user-agent; bh=zU9cMyUkca4kWvUJVjducHZl2lzeL+xM31Izn39uAw0=; b=GAbSnQ5xnpyQpJoLcbtNAY5XGeDOF5oi+Y1UHopJ0BFTUKZ2r8f8NyMKWDqULhJJg1 q3YZu1whEvx/R+RD/I3EV7SasTjvoB6qH6ADN4H3gAn10z/3vHtWr0EfWG71ZQeJP9lb dsGwMs9qpP7KmB6s7A+Qi6ioHrc3KdGh10E8D/AHTNzGrOHKRZOvc3EuInCP2x+iynZ1 jb7VMNhwftvHGyP0GkbuqW2pSwl8V6h80hN8xvV73owmaR0ngyvWBi15032b5snuGlnd RjzyGjhiRnhyIcz5mlXckfMkWQtlNCPSZ6NmuMnEfb2HNHVaxVHix/bc8rboRtGK3fMt OkYg== X-Gm-Message-State: AOAM531anMrlw9TWSUyPF0H9yUveqh+oZ2gZx2Obc0Wg+reO4E0Wis9i 6OWRIBru5tIDBuSvWRYrOsdQmA== X-Google-Smtp-Source: ABdhPJzPD/CldchMy8xq6tNjC3LCGwPowJHwv54xIQZ/ah8lxYXx/0Po15KnunXvEzj9J9Xbo0octQ== X-Received: by 2002:a02:6a0b:: with SMTP id l11mr1701069jac.82.1616573644374; Wed, 24 Mar 2021 01:14:04 -0700 (PDT) Received: from pryzbyj.telsasoft (charmander.telsasoft.com. [50.244.222.1]) by smtp.gmail.com with ESMTPSA id s5sm767153ild.13.2021.03.24.01.14.03 (version=TLS1_2 cipher=ECDHE-ECDSA-AES128-GCM-SHA256 bits=128/128); Wed, 24 Mar 2021 01:14:03 -0700 (PDT) Received: by pryzbyj.telsasoft (Postfix, from userid 1000) id 9B29E801A43; Wed, 24 Mar 2021 03:14:02 -0500 (CDT) Date: Wed, 24 Mar 2021 03:14:02 -0500 From: Justin Pryzby To: Tomas Vondra Cc: Dean Rasheed , pgsql-hackers@postgresql.org Subject: Re: PoC/WIP: Extended statistics on expressions Message-ID: <20210324081402.GB28335@telsasoft.com> References: <1913c1fe-13da-7250-adf4-befeda397536@enterprisedb.com> <9f6654b1-ca31-f979-0fe8-137683818273@enterprisedb.com> MIME-Version: 1.0 Content-Type: text/plain; charset=us-ascii Content-Disposition: inline In-Reply-To: <9f6654b1-ca31-f979-0fe8-137683818273@enterprisedb.com> User-Agent: Mutt/1.9.4 (2018-02-28) List-Id: List-Help: List-Subscribe: List-Post: List-Owner: List-Archive: Archived-At: Precedence: bulk I got this crash running sqlsmith: #1 0x00007f907574b801 in __GI_abort () at abort.c:79 #2 0x00005646b95a35f8 in ExceptionalCondition (conditionName=conditionName@entry=0x5646b97411db "bms_num_members(varnos) == 1", errorType=errorType@entry=0x5646b95fa00b "FailedAssertion", fileName=fileName@entry=0x5646b9739dbe "selfuncs.c", lineNumber=lineNumber@entry=3332) at assert.c:69 #3 0x00005646b955c9a1 in add_unique_group_expr (vars=0x5646bbd9e200, expr=0x5646b9eb0c30, exprinfos=0x5646bbd9e100, root=0x5646ba9a0cb0) at selfuncs.c:3332 #4 add_unique_group_expr (root=0x5646ba9a0cb0, exprinfos=0x5646bbd9e100, expr=0x5646b9eb0c30, vars=0x5646bbd9e200) at selfuncs.c:3307 #5 0x00005646b955d560 in estimate_num_groups () at selfuncs.c:3558 #6 0x00005646b93ad004 in create_distinct_paths (input_rel=, root=0x5646ba9a0cb0) at planner.c:4808 #7 grouping_planner () at planner.c:2238 #8 0x00005646b93ae0ef in subquery_planner (glob=glob@entry=0x5646ba9a0b98, parse=parse@entry=0x5646ba905d80, parent_root=parent_root@entry=0x0, hasRecursion=hasRecursion@entry=false, tuple_fraction=tuple_fraction@entry=0) at planner.c:1024 #9 0x00005646b93af543 in standard_planner (parse=0x5646ba905d80, query_string=, cursorOptions=256, boundParams=) at planner.c:404 #10 0x00005646b94873ac in pg_plan_query (querytree=0x5646ba905d80, query_string=0x5646b9cd87e0 "select distinct \n \n pg_catalog.variance(\n cast(pg_catalog.pg_stat_get_bgwriter_timed_checkpoints() as int8)) over (partition by subq_0.c2 order by subq_0.c0) as c0, \n subq_0.c2 as c1, \n sub"..., cursorOptions=256, boundParams=0x0) at postgres.c:821 #11 0x00005646b94874a1 in pg_plan_queries (querytrees=0x5646baaba250, query_string=query_string@entry=0x5646b9cd87e0 "select distinct \n \n pg_catalog.variance(\n cast(pg_catalog.pg_stat_get_bgwriter_timed_checkpoints() as int8)) over (partition by subq_0.c2 order by subq_0.c0) as c0, \n subq_0.c2 as c1, \n sub"..., cursorOptions=cursorOptions@entry=256, boundParams=boundParams@entry=0x0) at postgres.c:912 #12 0x00005646b9487888 in exec_simple_query () at postgres.c:1104 2021-03-24 03:06:12.489 CDT postmaster[11653] LOG: server process (PID 11696) was terminated by signal 6: Aborted 2021-03-24 03:06:12.489 CDT postmaster[11653] DETAIL: Failed process was running: select distinct pg_catalog.variance( cast(pg_catalog.pg_stat_get_bgwriter_timed_checkpoints() as int8)) over (partition by subq_0.c2 order by subq_0.c0) as c0, subq_0.c2 as c1, subq_0.c0 as c2, subq_0.c2 as c3, subq_0.c1 as c4, subq_0.c1 as c5, subq_0.c0 as c6 from (select ref_1.foreign_server_catalog as c0, ref_1.authorization_identifier as c1, sample_2.tgname as c2, ref_1.foreign_server_catalog as c3 from pg_catalog.pg_stat_database_conflicts as ref_0 left join information_schema._pg_user_mappings as ref_1 on (ref_0.datname < ref_0.datname) inner join pg_catalog.pg_amproc as sample_0 tablesample system (5) on (cast(null as uuid) < cast(null as uuid)) left join pg_catalog.pg_aggregate as sample_1 tablesample system (2.9) on (sample_0.amprocnum = sample_1.aggnumdirectargs ) inner join pg_catalog.pg_trigger as sample_2 tablesampl