Re: PoC/WIP: Extended statistics on expressions

From: Tomas Vondra <tomas(dot)vondra(at)enterprisedb(dot)com>
To: Justin Pryzby <pryzby(at)telsasoft(dot)com>
Cc: Dean Rasheed <dean(dot)a(dot)rasheed(at)gmail(dot)com>, pgsql-hackers(at)postgresql(dot)org
Subject: Re: PoC/WIP: Extended statistics on expressions
Date: 2021-03-24 08:54:22
Message-ID: b8359875-b91f-ff48-4c6c-9b3c1c35d880@enterprisedb.com
Views: Raw Message | Whole Thread | Download mbox | Resend email
Thread:
Lists: pgsql-hackers

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(at)entry=0x5646b97411db "bms_num_members(varnos) == 1", errorType=errorType(at)entry=0x5646b95fa00b "FailedAssertion",
> fileName=fileName(at)entry=0x5646b9739dbe "selfuncs.c", lineNumber=lineNumber(at)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=<optimized out>, root=0x5646ba9a0cb0) at planner.c:4808
> #7 grouping_planner () at planner.c:2238
> #8 0x00005646b93ae0ef in subquery_planner (glob=glob(at)entry=0x5646ba9a0b98, parse=parse(at)entry=0x5646ba905d80, parent_root=parent_root(at)entry=0x0, hasRecursion=hasRecursion(at)entry=false, tuple_fraction=tuple_fraction(at)entry=0)
> at planner.c:1024
> #9 0x00005646b93af543 in standard_planner (parse=0x5646ba905d80, query_string=<optimized out>, cursorOptions=256, boundParams=<optimized out>) 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(at)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(at)entry=256, boundParams=boundParams(at)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

In response to

Responses

Browse pgsql-hackers by date

  From Date Subject
Next Message Dilip Kumar 2021-03-24 08:54:41 Re: [HACKERS] Custom compression methods
Previous Message Julien Rouhaud 2021-03-24 08:51:40 Re: Feature improvement: can we add queryId for pg_catalog.pg_stat_activity view?