Received: from malur.postgresql.org ([217.196.149.56]) by arkaria.postgresql.org with esmtp (Exim 4.80) (envelope-from ) id 1XUMEs-0000TD-3X for pgsql-bugs@arkaria.postgresql.org; Wed, 17 Sep 2014 20:54:10 +0000 Received: from localhost ([127.0.0.1] helo=postgresql.org) by malur.postgresql.org with smtp (Exim 4.80) (envelope-from ) id 1XUMEr-0006eu-D8 for pgsql-bugs@arkaria.postgresql.org; Wed, 17 Sep 2014 20:54:09 +0000 Received: from makus.postgresql.org ([2001:4800:1501:1::229]) by malur.postgresql.org with esmtps (TLS1.2:DHE_RSA_AES_256_CBC_SHA256:256) (Exim 4.80) (envelope-from ) id 1XUMEp-0006cH-VB for pgsql-bugs@postgresql.org; Wed, 17 Sep 2014 20:54:08 +0000 Received: from mail-ig0-x235.google.com ([2607:f8b0:4001:c05::235]) by makus.postgresql.org with esmtps (TLS1.0:RSA_AES_256_CBC_SHA1:256) (Exim 4.80) (envelope-from ) id 1XUMEm-0004GI-Rp for pgsql-bugs@postgresql.org; Wed, 17 Sep 2014 20:54:06 +0000 Received: by mail-ig0-f181.google.com with SMTP id h3so93413igd.14 for ; Wed, 17 Sep 2014 13:54:03 -0700 (PDT) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=gmail.com; s=20120113; h=date:from:to:subject:message-id:user-agent:mime-version :content-transfer-encoding:content-type; bh=aZornVay4x1beX8FxixrzLShEjK5DeQxz28skTVWH7I=; b=FODttqzu1VxMgDYB6cOPYORR0UyYZbP5OV+ECpcL0cFSXKFbHNijGkB1fqj6JXGrQj gPQidT3wreAaPKGF0N1ZpnGi41CL2re+K7b5KqwaYMVkWR3Brj27dG87a7pE13qsYm5m umxhB4jzT+U6PSNhx4m8X1Rb5vuOsUtzHYemRnY+MNG3xvKG7+CJ+4rdrJatX0noe5In ma2quVEmISoMk6fgSbROfuSuwAQjlRC34IK9AtpjKUS/nuyDHyldPVFUgny55vwjzLld bg23JfBlnlttMt04kXOAu3C3W513LVl0k5vIgf9+5TFOIIbHFFomrV/M87B8DX+F78py s+Sg== X-Received: by 10.42.35.8 with SMTP id o8mr7946254icd.41.1410987243076; Wed, 17 Sep 2014 13:54:03 -0700 (PDT) Received: from klinga.prans.org (hq.sprymix.net. [66.207.200.154]) by mx.google.com with ESMTPSA id z5sm338939igl.21.2014.09.17.13.54.01 for (version=TLSv1.2 cipher=ECDHE-RSA-AES128-GCM-SHA256 bits=128/128); Wed, 17 Sep 2014 13:54:01 -0700 (PDT) Date: Wed, 17 Sep 2014 13:54:01 -0700 (PDT) X-Google-Original-Date: Wed, 17 Sep 2014 16:54 -0400 From: Elvis Pranskevichus To: pgsql-bugs@postgresql.org Subject: Assertion failure in get_appendrel_parampathinfo Message-ID: <2326379.AOuSqtNClj@klinga.prans.org> User-Agent: KMail/4.12.5 (Linux/3.16.1; KDE/4.12.5; x86_64; ; ) MIME-Version: 1.0 Content-Transfer-Encoding: quoted-printable Content-Type: text/plain; charset="utf-8" X-Pg-Spam-Score: -2.0 (--) List-Archive: List-Help: List-ID: List-Owner: List-Post: List-Subscribe: List-Unsubscribe: X-Mailing-List: pgsql-bugs Precedence: bulk Sender: pgsql-bugs-owner@postgresql.org Postgres 9.4beta2 and later crashes given the following query: BEGIN; CREATE TABLE k ( id int ); CREATE UNIQUE INDEX k_idx ON k (id); INSERT INTO k VALUES(1); CREATE TABLE link ( source int, target int ); CREATE UNIQUE INDEX l_idx ON link (source, target); CREATE TABLE b ( id int ); CREATE UNIQUE INDEX b_idx ON b (id); CREATE TABLE d () INHERITS (b); CREATE UNIQUE INDEX d_idx ON d (id); ANALYZE; SELECT 1 FROM k AS k1 WHERE EXISTS ( (SELECT True FROM k AS k2 INNER JOIN ( link INNER JOIN (SELECT id FROM b UNION ALL SELECT id FROM d) AS v ON (link.target =3D v.id) ) ON (k2.id =3D link.source=20 AND k1.id =3D link.source) ) ); ROLLBACK; Which generates the following query plan: QUERY PLAN=20=20=20=20=20=20=20= =20=20=20=20=20=20=20=20=20=20=20=20=20=20=20=20=20=20=20=20=20=20=20=20=20= =20=20=20=20=20=20=20=20=20=20=20=20 =E2=94=80=E2=94=80=E2=94=80=E2=94=80=E2=94=80=E2=94=80=E2=94=80=E2=94=80=E2= =94=80=E2=94=80=E2=94=80=E2=94=80=E2=94=80=E2=94=80=E2=94=80=E2=94=80=E2=94= =80=E2=94=80=E2=94=80=E2=94=80=E2=94=80=E2=94=80=E2=94=80=E2=94=80=E2=94=80= =E2=94=80=E2=94=80=E2=94=80=E2=94=80=E2=94=80=E2=94=80=E2=94=80=E2=94=80=E2= =94=80=E2=94=80=E2=94=80=E2=94=80=E2=94=80=E2=94=80=E2=94=80=E2=94=80=E2=94= =80=E2=94=80=E2=94=80=E2=94=80=E2=94=80=E2=94=80=E2=94=80=E2=94=80=E2=94=80= =E2=94=80=E2=94=80=E2=94=80=E2=94=80=E2=94=80=E2=94=80=E2=94=80=E2=94=80=E2= =94=80=E2=94=80=E2=94=80=E2=94=80=E2=94=80=E2=94=80=E2=94=80=E2=94=80=E2=94= =80=E2=94=80=E2=94=80=E2=94=80=E2=94=80=E2=94=80=E2=94=80=E2=94=80=E2=94=80= =E2=94=80=E2=94=80=E2=94=80=E2=94=80=E2=94=80=E2=94=80=E2=94=80=E2=94=80=E2= =94=80=E2=94=80=E2=94=80=E2=94=80=E2=94=80=E2=94=80=E2=94=80=E2=94=80=E2=94= =80=E2=94=80=E2=94=80=E2=94=80=E2=94=80=E2=94=80=E2=94=80 Seq Scan on k k1 (cost=3D0.00..1.33 rows=3D1 width=3D0) Filter: (SubPlan 1) SubPlan 1 -> Nested Loop (cost=3D0.15..44.43 rows=3D264 width=3D0) -> Seq Scan on k k2 (cost=3D0.00..1.01 rows=3D1 width=3D4) Filter: (id =3D k1.id) -> Nested Loop (cost=3D0.15..40.77 rows=3D264 width=3D4) -> Append (cost=3D0.00..40.18 rows=3D3 width=3D4) -> Seq Scan on b (cost=3D0.00..0.00 rows=3D1 width= =3D4) Filter: (id =3D id) -> Index Only Scan using d_idx on d d_1 (cost=3D0.= 15..0.18 rows=3D1 width=3D4) Index Cond: (id =3D id) -> Seq Scan on d (cost=3D0.00..40.00 rows=3D1 widt= h=3D4) Filter: (id =3D id) -> Index Only Scan using l_idx on link (cost=3D0.15..0.1= 9 rows=3D1 width=3D8) Index Cond: ((source =3D k1.id) AND (target =3D b.id= )) Planning time: 0.411 ms (17 rows) Traceback: #0 0x00007fc0e05cc2f7 in raise () from /lib64/libc.so.6 #1 0x00007fc0e05cd638 in abort () from /lib64/libc.so.6 #2 0x00000000008e9445 in ExceptionalCondition (conditionName=3D0xa75e10 "!= (!bms_overlap(appendrel->relids, required_outer))", errorType=3D0xa75b5a "F= ailedAssertion", fileName=3D0xa75b50 "relnode.c", lineNumber=3D983) at asse= rt.c:54 #3 0x0000000000720dda in get_appendrel_parampathinfo (appendrel=3D0x13f634= 0, required_outer=3D0x1400c90) at relnode.c:983 #4 0x0000000000718b55 in create_append_path (rel=3D0x13f6340, subpaths=3D0= x1403ff0, required_outer=3D0x1400c90) at pathnode.c:897 #5 0x00000000006d309a in set_append_rel_pathlist (root=3D0x13ef630, rel=3D= 0x13f6340, rti=3D3, rte=3D0x13ecbd8) at allpaths.c:855 #6 0x00000000006d23e1 in set_rel_pathlist (root=3D0x13ef630, rel=3D0x13f63= 40, rti=3D3, rte=3D0x13ecbd8) at allpaths.c:320 #7 0x00000000006d21c2 in set_base_rel_pathlists (root=3D0x13ef630) at allp= aths.c:222 #8 0x00000000006d202f in make_one_rel (root=3D0x13ef630, joinlist=3D0x13f5= cf0) at allpaths.c:152 #9 0x00000000006f846f in query_planner (root=3D0x13ef630, tlist=3D0x0, qp_= callback=3D0x6fc460 , qp_extra=3D0x7fffe32c28a0) at p= lanmain.c:236 #10 0x00000000006fa484 in grouping_planner (root=3D0x13ef630, tuple_fractio= n=3D1) at planner.c:1288 #11 0x00000000006f91d1 in subquery_planner (glob=3D0x1380d00, parse=3D0x13e= c4d8, parent_root=3D0x13825b8, hasRecursion=3D0 '\000', tuple_fraction=3D1,= subroot=3D0x7fffe32c2aa8) at planner.c:573 #12 0x000000000070288f in make_subplan (root=3D0x13825b8, orig_subquery=3D0= x137dcd8, subLinkType=3DEXISTS_SUBLINK, subLinkId=3D0, testexpr=3D0x0, isTo= pQual=3D1 '\001') at subselect.c:490 #13 0x0000000000704b77 in process_sublinks_mutator (node=3D0x13ec480, conte= xt=3D0x7fffe32c2ba0) at subselect.c:1862 #14 0x0000000000704ada in SS_process_sublinks (root=3D0x13825b8, expr=3D0x1= 3ec480, isQual=3D1 '\001') at subselect.c:1835 #15 0x00000000006f941c in preprocess_expression (root=3D0x13825b8, expr=3D0= x13ec480, kind=3D0) at planner.c:693 #16 0x00000000006f94fc in preprocess_qual_conditions (root=3D0x13825b8, jtn= ode=3D0x1382850) at planner.c:738 #17 0x00000000006f8dae in subquery_planner (glob=3D0x1380d00, parse=3D0x137= d8a0, parent_root=3D0x0, hasRecursion=3D0 '\000', tuple_fraction=3D0, subro= ot=3D0x7fffe32c2d48) at planner.c:443 #18 0x00000000006f86f8 in standard_planner (parse=3D0x137d8a0, cursorOption= s=3D0, boundParams=3D0x0) at planner.c:210 #19 0x00000000006f855c in planner (parse=3D0x137d8a0, cursorOptions=3D0, bo= undParams=3D0x0) at planner.c:139 #20 0x00000000007b04c7 in pg_plan_query (querytree=3D0x137d8a0, cursorOptio= ns=3D0, boundParams=3D0x0) at postgres.c:750 #21 0x00000000007b057a in pg_plan_queries (querytrees=3D0x1382580, cursorOp= tions=3D0, boundParams=3D0x0) at postgres.c:809 #22 0x00000000007b0885 in exec_simple_query (query_string=3D0x1309788 "BEGI= N;\n\nCREATE TABLE k (\n id int\n);\nCREATE UNIQUE INDEX k_idx ON k (id)= ;\n\nINSERT INTO k VALUES(1);\n\nCREATE TABLE link (\n source int,\n = target int\n);\nCREATE UNIQUE INDEX l_idx ON link (source, "...) at postgre= s.c:974 #23 0x00000000007b4de6 in PostgresMain (argc=3D10, argv=3D0x12b5040, dbname= =3D0x12d2350 "template1", username=3D0x12bcc60 "elvis") at postgres.c:4010 #24 0x000000000069757e in main (argc=3D10, argv=3D0x12b5040) at main.c:215 Elvis --=20 Sent via pgsql-bugs mailing list (pgsql-bugs@postgresql.org) To make changes to your subscription: http://www.postgresql.org/mailpref/pgsql-bugs