Received: from malur.postgresql.org ([217.196.149.56]) by arkaria.postgresql.org with esmtps (TLS1.3) tls TLS_ECDHE_RSA_WITH_AES_256_GCM_SHA384 (Exim 4.94.2) (envelope-from ) id 1tlqzC-002NiV-99 for pgsql-hackers@arkaria.postgresql.org; Sat, 22 Feb 2025 15:00:10 +0000 Received: from localhost ([127.0.0.1] helo=malur.postgresql.org) by malur.postgresql.org with esmtp (Exim 4.94.2) (envelope-from ) id 1tlqzB-00CL9e-7l for pgsql-hackers@arkaria.postgresql.org; Sat, 22 Feb 2025 15:00:09 +0000 Received: from makus.postgresql.org ([2001:4800:3e1:1::229]) by malur.postgresql.org with esmtps (TLS1.3) tls TLS_ECDHE_RSA_WITH_AES_256_GCM_SHA384 (Exim 4.94.2) (envelope-from ) id 1tlqzA-00CL9L-UJ for pgsql-hackers@lists.postgresql.org; Sat, 22 Feb 2025 15:00:08 +0000 Received: from mail-wm1-x32d.google.com ([2a00:1450:4864:20::32d]) by makus.postgresql.org with esmtps (TLS1.3) tls TLS_ECDHE_RSA_WITH_AES_128_GCM_SHA256 (Exim 4.96) (envelope-from ) id 1tlqz7-0009i8-1a for pgsql-hackers@postgresql.org; Sat, 22 Feb 2025 15:00:08 +0000 Received: by mail-wm1-x32d.google.com with SMTP id 5b1f17b1804b1-4398c8c8b2cso30799435e9.2 for ; Sat, 22 Feb 2025 07:00:06 -0800 (PST) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=gmail.com; s=20230601; t=1740236405; x=1740841205; darn=postgresql.org; h=in-reply-to:from:content-language:references:cc:to:subject :user-agent:mime-version:date:message-id:from:to:cc:subject:date :message-id:reply-to; bh=HvGhtnaFKCn4fsDwLsX++hYz/Jc3nVwYzkPz9AXz0aE=; b=jZRcNUuIZwdod/enZR8dVW+eNfQ/wu03q26SJhjxgEik12VLlwmEndC1fB7DvtjrR5 OHCW05c8KMSEButuUd6KhKtCJqfDOwkYYYFbf+X3dn0McrNjNg4vKhGd96d4qsKam5PH 3Lv43vT73COztVzbmgz1tDWn+CVZin1dAVdX7v6ZPpCU/px6WqHwojRYuq1PB3TmRPFX 5vpglCW6fp++E1mazPcQA1AYR44EyaZlVOKXvAlYyLtWRyevPsv/o4Uh8vsB0rwhSkIl MleM5fVM3qg/tXExKQR22ZcNJ9vjJIJSxnTCI/2IFJiDVxUurvojxQfkJQR1WuAwNrPl OH1Q== X-Google-DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=1e100.net; s=20230601; t=1740236405; x=1740841205; h=in-reply-to:from:content-language:references:cc:to:subject :user-agent:mime-version:date:message-id:x-gm-message-state:from:to :cc:subject:date:message-id:reply-to; bh=HvGhtnaFKCn4fsDwLsX++hYz/Jc3nVwYzkPz9AXz0aE=; b=OM2HuZFdzhZ42tfG8t8t+AmC3LGBpbQMF8tozhVuQ59ns2c3Aa5E7v9IyV448Yr+8h qhU96rjdfHf/zSjzOQAUmUICDeGys6KDWW60sZ1LKyKNqi2QJIw2gESKAkSWchV1ZgeV Yss5ysnXQFkl7J6ZTdk1Uda1Tcn17luBA+22597vNGzCq9fSL2Vj3iSdozgLMHTl8eRC C2ZOVLQ1Ok+AceHD5dz0GiYW0akzdrF6dppNeU+xHwIvhx+rzxlY97mqRCxQ1sA/3IVS XUncXpo5kHsnoe1vCyIpvn3FXLIVwEK1i+//r7qyzv3ZBCVVxr33qD0FtHg14uOmrAT2 qeJA== X-Forwarded-Encrypted: i=1; AJvYcCXFtALHDSAN9Pl2KHJ5bAlDZxvK70e7T99vvoFEjbWO2T4l6PkJNTgbzhWcWvEw2ZM9ptBTA3e14ag2ua7N@postgresql.org X-Gm-Message-State: AOJu0YwoY+F1sDv0VFeRk1PQnslvduGmxT01ndTGY9AASRuY4l8vJ+i4 9EaKvKxe5hZPHRlMgv7055xT0U2iy6HVevg16oaQgCzavB0nhtL2 X-Gm-Gg: ASbGncuv2XmJZRexsdhUgGBFtYmauGGGBBjc/yRJ9DBDXaFw28KH3vmENqudIXiTXuR pcWOACL6ZFdCluQmmgpg4yeOVsV3GwcS2mkk+c1abBj+vyU0FlG//fBuuf9oZhKyOGEuayNNpRD Psec6sF0YGliyvuJP9WkQe1/FffkR0xIwdclBoL3LZnb5XVJ/EavRSXMewrvy4P+BhU7hGr97Qn CdtRWch8cY6gj+/ODDSvwz7jtuND0uWR5juZB2N9CJQng/fDpr3103LVKv0sfUNmUhY4tFUpKR+ HnVx78Ab2XIZ/V7WmlEAsFldo/oG X-Google-Smtp-Source: AGHT+IFF86q0xozBSPIz+mMgxd5bhDMQxclgrkgWcKltgagpTpOg3DTmIY00pq+vxxpxHQ6vn4ipTA== X-Received: by 2002:a05:600c:190c:b0:439:a30f:2e67 with SMTP id 5b1f17b1804b1-439ae1f17c6mr70220345e9.17.1740236404928; Sat, 22 Feb 2025 07:00:04 -0800 (PST) Received: from [192.168.0.50] ([89.149.68.176]) by smtp.gmail.com with ESMTPSA id 5b1f17b1804b1-439b02d684dsm49066345e9.16.2025.02.22.07.00.02 (version=TLS1_3 cipher=TLS_AES_128_GCM_SHA256 bits=128/128); Sat, 22 Feb 2025 07:00:03 -0800 (PST) Content-Type: multipart/alternative; boundary="------------xiOi3ALduy8ONhUZ2Pt1ASnI" Message-ID: <74839af6-aadc-4f60-ae77-ae65f94bf607@gmail.com> Date: Sat, 22 Feb 2025 17:00:01 +0200 MIME-Version: 1.0 User-Agent: Mozilla Thunderbird Subject: Re: generic plans and "initial" pruning To: Amit Langote , Tomas Vondra Cc: Robert Haas , Alvaro Herrera , Andres Freund , Daniel Gustafsson , David Rowley , PostgreSQL Hackers , Thom Brown , Tom Lane References: <54c35fb9-da3a-4754-ab8c-46ed0b612465@vondra.me> <684c70d7-180e-461d-9377-600c2db581ba@vondra.me> Content-Language: en-US From: Alexander Lakhin In-Reply-To: List-Id: List-Help: List-Subscribe: List-Post: List-Owner: List-Archive: Archived-At: Precedence: bulk This is a multi-part message in MIME format. --------------xiOi3ALduy8ONhUZ2Pt1ASnI Content-Type: text/plain; charset=UTF-8; format=flowed Content-Transfer-Encoding: 8bit Hello Amit, 21.02.2025 05:40, Amit Langote wrote: > I pushed the final piece yesterday. Please look at new error, produced by the following script, starting from 525392d57: CREATE TABLE t(id int) PARTITION BY RANGE (id); CREATE INDEX idx on t(id); CREATE TABLE tp_1 PARTITION OF t FOR VALUES FROM (10) TO (20); CREATE TABLE tp_2 PARTITION OF t FOR VALUES FROM (20) TO (30) PARTITION BY RANGE(id); CREATE TABLE tp_2_1 PARTITION OF tp_2 FOR VALUES FROM (21) to (22); CREATE TABLE tp_2_2 PARTITION OF tp_2 FOR VALUES FROM (22) to (23); CREATE FUNCTION stable_one() RETURNS INT AS $$ BEGIN RETURN 1; END; $$ LANGUAGE plpgsql STABLE; SELECT min(id) OVER (PARTITION BY id ORDER BY id) FROM t WHERE id >= stable_one(); ERROR:  XX000: trying to open a pruned relation LOCATION:  ExecGetRangeTableRelation, execUtils.c:830 This issue was discovered with SQLsmith. Best regards, Alexander Lakhin Neon (https://neon.tech) --------------xiOi3ALduy8ONhUZ2Pt1ASnI Content-Type: text/html; charset=UTF-8 Content-Transfer-Encoding: 8bit
Hello Amit,

21.02.2025 05:40, Amit Langote wrote:
I pushed the final piece yesterday.

Please look at new error, produced by the following script,
starting from 525392d57:
CREATE TABLE t(id int) PARTITION BY RANGE (id);
CREATE INDEX idx on t(id);
CREATE TABLE tp_1 PARTITION OF t FOR VALUES FROM (10) TO (20);
CREATE TABLE tp_2 PARTITION OF t FOR VALUES FROM (20) TO (30) PARTITION BY RANGE(id);
CREATE TABLE tp_2_1 PARTITION OF tp_2 FOR VALUES FROM (21) to (22);
CREATE TABLE tp_2_2 PARTITION OF tp_2 FOR VALUES FROM (22) to (23);
CREATE FUNCTION stable_one() RETURNS INT AS $$ BEGIN RETURN 1; END; $$ LANGUAGE plpgsql STABLE;

SELECT min(id) OVER (PARTITION BY id ORDER BY id) FROM t WHERE id >= stable_one();

ERROR:  XX000: trying to open a pruned relation
LOCATION:  ExecGetRangeTableRelation, execUtils.c:830

This issue was discovered with SQLsmith.

Best regards,
Alexander Lakhin
Neon (https://neon.tech) --------------xiOi3ALduy8ONhUZ2Pt1ASnI--