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 1jlxcA-0005sD-St for pgsql-bugs@arkaria.postgresql.org; Thu, 18 Jun 2020 16:42:10 +0000 Received: from localhost ([127.0.0.1] helo=malur.postgresql.org) by malur.postgresql.org with esmtp (Exim 4.92) (envelope-from ) id 1jlxc9-0008Dk-MQ for pgsql-bugs@arkaria.postgresql.org; Thu, 18 Jun 2020 16:42:09 +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 <9erthalion6@gmail.com>) id 1jlxc8-0008Dd-Rb for pgsql-bugs@lists.postgresql.org; Thu, 18 Jun 2020 16:42:08 +0000 Received: from mail-ej1-x642.google.com ([2a00:1450:4864:20::642]) by makus.postgresql.org with esmtps (TLS1.3:ECDHE_RSA_AES_128_GCM_SHA256:128) (Exim 4.92) (envelope-from <9erthalion6@gmail.com>) id 1jlxc6-0000wT-93 for pgsql-bugs@lists.postgresql.org; Thu, 18 Jun 2020 16:42:07 +0000 Received: by mail-ej1-x642.google.com with SMTP id l12so7095396ejn.10 for ; Thu, 18 Jun 2020 09:42:05 -0700 (PDT) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=gmail.com; s=20161025; h=date:from:to:cc:subject:message-id:references:mime-version :content-disposition:in-reply-to; bh=szbJwqiDpN9gFTK9P0/oqZ4MP94T/H9UHY4PULTMszM=; b=QTdr25Uzo2eQr4hkN/uY2onfKvvcf3VAasARhStH+3gWM9YHTh+8+etgtF9FnbiL2i otY+d/oXe8sW13a9HEBn3mVYeWib+JRJCLr9lsXK3Jz50rOE76dMvjfthLsj0N0WJZhL Vmbj7VJZi4mv6gbE5duMxSJtG5oCEUrtpoH5/CqLQeTrYuGxfa+F+ByusIhNmKpxsBih Oe7ZrzVdkkO1E4qPXUlsROoJZ5T0R144XnRVaHNlCOMUjHpMA+Jd1AdWx/Vy4hRerRS3 Khx5UcX9lEISpiQmjztBn2y9QJYlHfFqLpM+RgETCZyHtRNnVcYSnklY3OMt4rWq4cdW gzaA== 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; bh=szbJwqiDpN9gFTK9P0/oqZ4MP94T/H9UHY4PULTMszM=; b=ePWkpU2JVyJFNVpyiW8FBNgUfYgPhFK0v4HxqCugUiegNE+wOp0NtnKsuOcAW2Y3Zm 6RbeIh+tntG3lzGsgksE5UOlY+aGW5nhlA11s4I80khvjLULzP1ubjMU/ODT5nrtTHML 21aVIRwSPIEeexCIvJG2SL/UNs7VgwPzpeicx+ti/IF/4ApWQHjUo9cZzmXAY7NsxWFr 4O/JemmZVm8mvP4+8VDDebHeaeohl9AmgmOHK36iGIGd8N2W6v65TFH/7rUfaMGOov9H nTS9cZzVkMNcrHYtYkiywiHZ3Llna9JIOyu5Jk+y+CWHjpg6CXyk5bdx7vJgfb2SIPJO wVNw== X-Gm-Message-State: AOAM5317ZQtDLCApNP6DLyjEu+4ZlJlyzZyux9pmm6u2ucH07sWHI24y deU2mE10Arx93OEUJQVG+Jc= X-Google-Smtp-Source: ABdhPJxHScR0TCD/7FG6yidyAEyk2NWO/eZfJe4N2DfGVcoz4fTjY7t4jXkW94Jkxe0NU/obkknVUA== X-Received: by 2002:a17:906:6888:: with SMTP id n8mr4588273ejr.159.1592498524644; Thu, 18 Jun 2020 09:42:04 -0700 (PDT) Received: from localhost (dslb-188-102-096-018.188.102.pools.vodafone-ip.de. [188.102.96.18]) by smtp.gmail.com with ESMTPSA id l8sm2677681ejc.85.2020.06.18.09.42.03 (version=TLS1_2 cipher=ECDHE-RSA-AES128-GCM-SHA256 bits=128/128); Thu, 18 Jun 2020 09:42:03 -0700 (PDT) Date: Thu, 18 Jun 2020 18:44:24 +0200 From: Dmitry Dolgov <9erthalion6@gmail.com> To: Etsuro Fujita Cc: hisanori.kobayashi.bp@nttdata.com, PostgreSQL mailing lists Subject: Re: BUG #16500: SQL Abend. select multi_key_columns_range_partition_table Message-ID: <20200618164424.7mz73igyejtmdjvp@localhost> References: <16500-d1613f2a78e1e090@postgresql.org> MIME-Version: 1.0 Content-Type: text/plain; charset=us-ascii Content-Disposition: inline In-Reply-To: List-Id: List-Help: List-Subscribe: List-Post: List-Owner: List-Archive: Precedence: bulk > On Thu, Jun 18, 2020 at 10:05:12PM +0900, Etsuro Fujita wrote: > On Thu, Jun 18, 2020 at 6:49 PM PG Bug reporting form > wrote: > > I will send a reproduction script. > > > drop table if exists pt_test01 ; > > create table pt_test01 > > ( kbn smallint not null > > , nen char(4) not null > > , mm char(2) not null > > , cd char(3) not null > > , val00 numeric(15, 3) > > , usr varchar(10) > > ) > > partition by range(kbn, nen) with (oids=false) > > ; > > create table pt_test01_1_2019 partition of pt_test01 for values from (1, > > '2019') to (1, '2020') ; > > create table pt_test01_1_2020 partition of pt_test01 for values from (1, > > '2020') to (1, '2021') ; > > create table pt_test01_2_2019 partition of pt_test01 for values from (2, > > '2019') to (2, '2020') ; > > create table pt_test01_2_2020 partition of pt_test01 for values from (2, > > '2020') to (2, '2021') ; > > > select * from pt_test01 where kbn <= 1 and nen = '2020' ; > > This caused a server crash in my environment as well. Maybe I'm > missing something, but ISTM that it's odd to allow partitions with > empty range bounds. I'll dig into this (and another one Kobayashi-san > reported). Yep, I also can reproduce it easily. Can't say I'm familiar with this code, but after looking through it a bit it seems something strange is going on with a pruning step generated using prefix. Looks like it has only expressions for the second attribute of the partition key, but tries to compare with the full boundinfo. Without this pruning step the query above doesn't crash for me.