pg.ddx.io  pgsql-hackers@postgresql.org mailing list archive  
help / color / mirror / Atom feed
From: Justin Pryzby <pryzby@telsasoft.com>
To: Etsuro Fujita <etsuro.fujita@gmail.com>
Cc: Zhihong Yu <zyu@yugabyte.com>
Cc: Alexander Pyhalov <a.pyhalov@postgrespro.ru>
Cc: Andrey V. Lepikhov <a.lepikhov@postgrespro.ru>
Cc: Kyotaro Horiguchi <horikyota.ntt@gmail.com>
Cc: pgsql-hackers@lists.postgresql.org
Subject: Re: Defer selection of asynchronous subplans until the executor initialization stage
Date: Fri, 8 Apr 2022 07:43:38 -0500
Message-ID: <20220408124338.GK24419@telsasoft.com> (raw)
In-Reply-To: <CAPmGK17uV9BoLnAmh845zcFpMEOEEaoqoYd3noC2WEkqkvvKHg@mail.gmail.com>
References: <edb1331c-e861-0c53-9fdb-f7ca7dfd884d@postgrespro.ru>
	<CAPmGK15AshMEtgUqs3yZfD5mzW87wyn=_uAXbBeRLG0nod7vHA@mail.gmail.com>
	<8891e9b4-040f-6d71-fa63-3069046dfb3d@postgrespro.ru>
	<CAPmGK14xPU5KaQZ_yjNbOmx-vehmbD-M90LpSXHG+KoEbmv9eQ@mail.gmail.com>
	<932e6ed12832831592d01a3b06c16d63@postgrespro.ru>
	<CAPmGK17XPqcZ19eKS09KXshBRZmWxitjs_RZTj8bjCVOQfBHnQ@mail.gmail.com>
	<CAPmGK17ptUuZPTmzzRA_rcXSS-x++T7Ocv9UVcfYgnC21XQ9Gw@mail.gmail.com>
	<CALNJ-vTyXON6XjumbFPMw6RFRwXFsnATnzUpAvtafFRKzC=AQA@mail.gmail.com>
	<CAPmGK16aVQ+GHV=i4FToSmEHV8y0FD7JGPJnAzjksOkkrqRcHw@mail.gmail.com>
	<CAPmGK17uV9BoLnAmh845zcFpMEOEEaoqoYd3noC2WEkqkvvKHg@mail.gmail.com>

On Wed, Apr 06, 2022 at 03:58:29PM +0900, Etsuro Fujita wrote:
> I have committed the patch after modifying it as such.  (I think we
> can improve these later, if necessary.)

This patch seems to be causing the planner to crash.
Here's a query reduced from sqlsmith.

| explain SELECT 1 FROM information_schema.constraint_column_usage WHERE 1 <= pg_trigger_depth();

Program terminated with signal SIGSEGV, Segmentation fault.
#0  0x000055b4396a2edf in trivial_subqueryscan (plan=0x7f4219ed93b0) at ../../../../src/include/nodes/pg_list.h:151
151             return l ? l->length : 0;
(gdb) bt
#0  0x000055b4396a2edf in trivial_subqueryscan (plan=0x7f4219ed93b0) at ../../../../src/include/nodes/pg_list.h:151
#1  0x000055b43968af89 in mark_async_capable_plan (plan=plan@entry=0x7f4219ed93b0, path=path@entry=0x7f4219e89538) at createplan.c:1132
#2  0x000055b439691924 in create_append_plan (root=root@entry=0x55b43affb2b0, best_path=best_path@entry=0x7f4219ed0cb8, flags=flags@entry=0) at createplan.c:1329
#3  0x000055b43968fa21 in create_plan_recurse (root=root@entry=0x55b43affb2b0, best_path=best_path@entry=0x7f4219ed0cb8, flags=flags@entry=0) at createplan.c:421
#4  0x000055b43968f974 in create_projection_plan (root=root@entry=0x55b43affb2b0, best_path=best_path@entry=0x7f4219ed0f60, flags=flags@entry=1) at createplan.c:2039
#5  0x000055b43968fa6f in create_plan_recurse (root=root@entry=0x55b43affb2b0, best_path=0x7f4219ed0f60, flags=flags@entry=1) at createplan.c:433
#6  0x000055b439690221 in create_plan (root=root@entry=0x55b43affb2b0, best_path=<optimized out>) at createplan.c:348
#7  0x000055b4396a1451 in standard_planner (parse=0x55b43af05e28, query_string=<optimized out>, cursorOptions=2048, boundParams=0x0) at planner.c:413
#8  0x000055b4396a19c1 in planner (parse=parse@entry=0x55b43af05e28, query_string=query_string@entry=0x55b43af04c40 "SELECT 1 FROM information_schema.constraint_column_usage WHERE 1 > pg_trigger_depth();", 
    cursorOptions=cursorOptions@entry=2048, boundParams=boundParams@entry=0x0) at planner.c:277
#9  0x000055b439790c78 in pg_plan_query (querytree=querytree@entry=0x55b43af05e28, query_string=query_string@entry=0x55b43af04c40 "SELECT 1 FROM information_schema.constraint_column_usage WHERE 1 > pg_trigger_depth();", 
    cursorOptions=cursorOptions@entry=2048, boundParams=boundParams@entry=0x0) at postgres.c:883
#10 0x000055b439790d54 in pg_plan_queries (querytrees=0x55b43afdd528, query_string=query_string@entry=0x55b43af04c40 "SELECT 1 FROM information_schema.constraint_column_usage WHERE 1 > pg_trigger_depth();", 
    cursorOptions=cursorOptions@entry=2048, boundParams=boundParams@entry=0x0) at postgres.c:975
#11 0x000055b439791239 in exec_simple_query (query_string=query_string@entry=0x55b43af04c40 "SELECT 1 FROM information_schema.constraint_column_usage WHERE 1 > pg_trigger_depth();") at postgres.c:1169
#12 0x000055b439793183 in PostgresMain (dbname=<optimized out>, username=<optimized out>) at postgres.c:4542
#13 0x000055b4396e6af7 in BackendRun (port=port@entry=0x55b43af2ffe0) at postmaster.c:4489
#14 0x000055b4396e9c03 in BackendStartup (port=port@entry=0x55b43af2ffe0) at postmaster.c:4217
#15 0x000055b4396e9e4a in ServerLoop () at postmaster.c:1791
#16 0x000055b4396eb401 in PostmasterMain (argc=7, argv=<optimized out>) at postmaster.c:1463
#17 0x000055b43962b4df in main (argc=7, argv=0x55b43aeff0c0) at main.c:202

Actually, the original query failed like this:
#2  0x000055b4398e9f90 in ExceptionalCondition (conditionName=conditionName@entry=0x55b439a61238 "plan->scanstatus == SUBQUERY_SCAN_UNKNOWN", errorType=errorType@entry=0x55b43994b00b "FailedAssertion", 
#3  0x000055b4396a2ecf in trivial_subqueryscan (plan=0x55b43b59cac8) at setrefs.c:1367





view thread (33+ messages)  latest in thread

Message-ID: <20220408124338.GK24419@telsasoft.com>
Permalink:  ../20220408124338.GK24419@telsasoft.com/
Also on:    postgresql.org/message-id/20220408124338.GK24419@telsasoft.com

 · 

reply

Reply instructions:

You may reply publicly to this message via plain-text email
using any one of the following methods:

* Reply to all the recipients using the --to and --cc options:
  reply via email

  To: pgsql-hackers@postgresql.org
  Cc: pryzby@telsasoft.com, etsuro.fujita@gmail.com, zyu@yugabyte.com, a.pyhalov@postgrespro.ru, a.lepikhov@postgrespro.ru, horikyota.ntt@gmail.com, pgsql-hackers@lists.postgresql.org
  Subject: Re: Defer selection of asynchronous subplans until the executor initialization stage
  In-Reply-To: <20220408124338.GK24419@telsasoft.com>

* Save the following mbox file, import it into your mail client,
  and reply-to-all from there: mbox

This inbox is served by DDX for PostgreSQL; see mirroring instructions
for how to clone and mirror all data and code used for this inbox