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 1lOzHc-0001Yo-3u for pgsql-hackers@arkaria.postgresql.org; Wed, 24 Mar 2021 08:54:32 +0000 Received: from localhost ([127.0.0.1] helo=malur.postgresql.org) by malur.postgresql.org with esmtp (Exim 4.92) (envelope-from ) id 1lOzHb-00071k-13 for pgsql-hackers@arkaria.postgresql.org; Wed, 24 Mar 2021 08:54:31 +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 1lOzHa-00071c-HY for pgsql-hackers@lists.postgresql.org; Wed, 24 Mar 2021 08:54:30 +0000 Received: from mail-ed1-x535.google.com ([2a00:1450:4864:20::535]) by makus.postgresql.org with esmtps (TLS1.3:ECDHE_RSA_AES_128_GCM_SHA256:128) (Exim 4.92) (envelope-from ) id 1lOzHX-0003eC-Q7 for pgsql-hackers@postgresql.org; Wed, 24 Mar 2021 08:54:29 +0000 Received: by mail-ed1-x535.google.com with SMTP id h10so26650698edt.13 for ; Wed, 24 Mar 2021 01:54:27 -0700 (PDT) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=enterprisedb-com.20150623.gappssmtp.com; s=20150623; h=subject:to:cc:references:from:message-id:date:user-agent :mime-version:in-reply-to:content-language:content-transfer-encoding; bh=lR87c9gganLyvhpYqRvcBcQ8DL3gAJWF7Bq1c4h2FuY=; b=HWw0LHyg21v/uo0N/BWRBXlO5l+8GHQDznfAwVpMZ0m68a32Yf/KfS1StM0pqONZJU yqLtRuDEOWuEbkL74uzFDZq0ZklU4+yW0v9f+sZr7ujRag3WhKn3E1SnyhHIDL3ootyp HbTxToHWNlFRUB2KqE2mMDeMkWpANEq03ihj5kOd65QkuaHXQQv2tj9EQaJegh06bs6g O0Mqg7Cz3oYASLQmsZ+5TrMigebRN2gfdplpgnBq/xgRBk0y1wI6tp8BPil+zSvACldS qOqu0PEDBI5tLJypc8idb4kJMYdL2yi6yhhyZpuetXT7C705llMhw+0u1U7zJorLEt9L gFog== X-Google-DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=1e100.net; s=20161025; h=x-gm-message-state:subject:to:cc:references:from:message-id:date :user-agent:mime-version:in-reply-to:content-language :content-transfer-encoding; bh=lR87c9gganLyvhpYqRvcBcQ8DL3gAJWF7Bq1c4h2FuY=; b=DmeH82KihvG1sEXyF3MsLr8IUxNTdJ9wzYR47R6S+SCiMcxl6lrZk0DddRSEvWUlfO uc2jZ7JN6Bx78JbzUo5R++BoOs5cRZqqMWNuDldkZslpmnIrUh6TwmUPQmnFRLmr7jVM pYAKehkHZGjUSeoKwbyEUp92UXEniX5lt/+7Zh8pqiJ8RA0J2uG5CUcXAGsSIzOfwe9g QlWluqkCa9GVs+IkoC7yUHExoxr5IbL9+DQ7jQK7nWc8+kHVac5cASZ/N9TtesgGH3uR lR2Vw9mCWxqiTtUsOMfEur5h6Il9ed4DIMSjivulzMEJLD93GbOscDyBBSmiEJ1b9AD5 2bQA== X-Gm-Message-State: AOAM532TNmkfCULS1WIeHW4O40oTde+OupnGpqey8zvdKv/2w4/AYkxr ZVJMJectqNQIF9/k5P4uhQ7JCgUD1lo3irLDC9XPknjA1MgC7Tg67UO3VkE0Od2TZsehd9IVvBr WQjejPN6HO7k+5qBD5BJvAmIIozqSMzwDPMZSrW6PlG2+DHkmGPitTS/7jdk62By+O1JsfKd6jK L/MJIA6c5AyZFT7puX/SGu8XEWK3DPLP1IPEPAiCovpmocYJv02aa34RNfsmlZL9hNlCSjYsrrL qPD5QWHuSEkPXTzHz0b9ScP66In9V8g8K7uCQ== X-Google-Smtp-Source: ABdhPJy0yUxB7A0ugmpWMDDg+oii2fkbVWIGGHpXqJFtGFlbuVhoSqecovPUODvgdDL89JXa+qBuqQ== X-Received: by 2002:a05:6402:168c:: with SMTP id a12mr2272384edv.344.1616576065892; Wed, 24 Mar 2021 01:54:25 -0700 (PDT) Received: from [10.137.0.20] (ip-86-49-253-127.net.upcbroadband.cz. [86.49.253.127]) by smtp.gmail.com with ESMTPSA id j25sm815524edy.9.2021.03.24.01.54.24 (version=TLS1_3 cipher=TLS_AES_128_GCM_SHA256 bits=128/128); Wed, 24 Mar 2021 01:54:25 -0700 (PDT) Subject: Re: PoC/WIP: Extended statistics on expressions To: Justin Pryzby Cc: Dean Rasheed , pgsql-hackers@postgresql.org References: <1913c1fe-13da-7250-adf4-befeda397536@enterprisedb.com> <9f6654b1-ca31-f979-0fe8-137683818273@enterprisedb.com> <20210324081402.GB28335@telsasoft.com> From: Tomas Vondra Message-ID: Date: Wed, 24 Mar 2021 09:54:22 +0100 User-Agent: Mozilla/5.0 (X11; Linux x86_64; rv:78.0) Gecko/20100101 Thunderbird/78.8.0 MIME-Version: 1.0 In-Reply-To: <20210324081402.GB28335@telsasoft.com> Content-Type: text/plain; charset=utf-8 Content-Language: en-US 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 Justin, Unfortunately the query is incomplete, so I can't quite determine what went wrong. Can you extract the full query causing the crash, either from the server log or from a core file? thanks On 3/24/21 9:14 AM, Justin Pryzby wrote: > 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 > -- Tomas Vondra EnterpriseDB: http://www.enterprisedb.com The Enterprise PostgreSQL Company