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.96) (envelope-from ) id 1wFVP1-005Da3-2g for pgsql-hackers@arkaria.postgresql.org; Wed, 22 Apr 2026 11:05:56 +0000 Received: from localhost ([127.0.0.1] helo=malur.postgresql.org) by malur.postgresql.org with esmtp (Exim 4.96) (envelope-from ) id 1wFVP0-00DA2j-31 for pgsql-hackers@arkaria.postgresql.org; Wed, 22 Apr 2026 11:05:54 +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.96) (envelope-from ) id 1wFVP0-00DA2b-1z for pgsql-hackers@lists.postgresql.org; Wed, 22 Apr 2026 11:05:54 +0000 Received: from mail-dy1-x132d.google.com ([2607:f8b0:4864:20::132d]) by makus.postgresql.org with esmtps (TLS1.3) tls TLS_ECDHE_RSA_WITH_AES_128_GCM_SHA256 (Exim 4.98.2) (envelope-from ) id 1wFVOx-00000002Ew8-4Bpx for pgsql-hackers@postgresql.org; Wed, 22 Apr 2026 11:05:53 +0000 Received: by mail-dy1-x132d.google.com with SMTP id 5a478bee46e88-2ba895adfeaso5727417eec.0 for ; Wed, 22 Apr 2026 04:05:52 -0700 (PDT) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=gmail.com; s=20251104; t=1776855951; x=1777460751; darn=postgresql.org; h=in-reply-to:references:subject:cc:to:from:message-id:date :content-transfer-encoding:mime-version:from:to:cc:subject:date :message-id:reply-to; bh=CejUMtKxrzItDrcaMU5PVA8ZSx23aGUinNnifw+qXp0=; b=gVFAbCZZyX7w+rZF0k2eEq9ye0DdnMQrsR5iSfEXvt0OuPShHltUAegzD2IJVPeJkr w2oNW3QQZNkWWsmAfrTRMDzYTOjYW+5axJ7LBU/ip21pkciGmKIYJ17MAhMB06tiSQ2u dLUKyCMJ0I7ml6xyl37Pk6rDpe6FGQ6TtnEBCsh/9SWUAy1XV6wJQKrCQe2n3yh3vn/G zZb/OK+brRpctTHqLFyMFPaowBHQLr3FxWcvCr4vIbNfhzHCeHDOl5nyiLFWW+fc86l8 ADhEeo62sRx3lDGrBd/nmE+NHTodbw9HL/OwRpfgrFBfOwnT0CVwfaOT22+52CKlzzMP mfwQ== X-Google-DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=1e100.net; s=20251104; t=1776855951; x=1777460751; h=in-reply-to:references:subject:cc:to:from:message-id:date :content-transfer-encoding:mime-version:x-gm-gg:x-gm-message-state :from:to:cc:subject:date:message-id:reply-to; bh=CejUMtKxrzItDrcaMU5PVA8ZSx23aGUinNnifw+qXp0=; b=M13zS7OMgc657HeJRQdjoRT2ZaSWpLWvUYmXinFmLaxpy65q+oyGTDA8P5HN/MMPNJ ytOIrp4fAzgnjE1tV2EZeyi3/5Ov+QMcCEKU32h54MR0chM3laND+un6x6tYfuhOYaOu LkvMFWrBQrjPm2XBk+30sSqPc+Mx/i4oeYzPbnaZtB5cuPcE9RymgnDhiyC25sDfZvn9 W7Tit6RG96/RVA4JT0BwiHWNv486a649mJr1atd7afchfZ2l7ZJakNLSJfiTL37VBcPC lKKAh2SivmP/uKJtn7WqgtQrTE9rKYVgzpSLV7ztaqjxAAlMjG6HbpdbaKs5pO0Q3U01 w8YQ== X-Forwarded-Encrypted: i=1; AFNElJ8PNHqBb6BwpgVsZK5ghNtD75bi16zq9RbHlHP87iaJ8RIPFsRFGKSbY6ExexqJVfKyloeShB5Jmt0cPFo1@postgresql.org X-Gm-Message-State: AOJu0Yydp/kTd2F36dZ+btmrcWN7mSal8RQnDlpxexeOLrNKc8PgHsSz vUhRSo27meprDGST1aTKXdtXR8DP3vIhutidWlVi1U87tuEG58GXdTbm X-Gm-Gg: AeBDievdibgkqoAtJHIWx6wuGx2dhOLsds7AC4IdOkS/Kj6UGmlpAgjGk/B+ujgRAnb DCJCX/UPMovU2+6A1V8Z92fMs1sMiyXG7NJqMVTYtJ8tu31CkxbYbhzxpMLeIeLloYqxzxUfBwN uAfUe0CUgZJ5tlYwmBtQ/J/oyJq4Tg4jIdNRGjp/N5VXHgBdOH26/T3Afg40Kt4/lgxR27u/spC dfxCK69akCsYdLz3b3HVVz49ExfXpmqVGy8nJzboRrRr0U3Ri58CGrnwtIQn6wuXvpi+emGwGSk KMGxFtuSe6EdlszjYFAELO8wNF0z7xXMubhdIoh51um6NC9dIRxQ6Z8yqN4J5XDuaavkb+W/Hu4 24zgO8i6Tf+5cYyV5ADRirwEHc4ZbdrkZ5OLyloeRBZ1++vp5l+4jX2Q3EttZMVPyOKS0/f+wiG Hu/zW6eFqeJY7WLZHtCvUGQUtFaHeB2MOLHNrsjGn2tB+OQIacdSybapXa X-Received: by 2002:a05:693c:2c09:b0:2df:c5bb:3720 with SMTP id 5a478bee46e88-2e47873a9demr12260313eec.15.1776855951336; Wed, 22 Apr 2026 04:05:51 -0700 (PDT) Received: from localhost ([2804:14d:328a:a59c:ec56:84f1:3be9:67e8]) by smtp.gmail.com with ESMTPSA id 5a478bee46e88-2e53d2cff04sm21748857eec.23.2026.04.22.04.05.49 (version=TLS1_3 cipher=TLS_AES_128_GCM_SHA256 bits=128/128); Wed, 22 Apr 2026 04:05:50 -0700 (PDT) Mime-Version: 1.0 Content-Transfer-Encoding: quoted-printable Content-Type: text/plain; charset=UTF-8 Date: Wed, 22 Apr 2026 08:05:47 -0300 Message-Id: From: "Matheus Alcantara" To: "Kirill Reshke" Cc: "Alexander Korotkov" , "Dmitry Koval" , "pgsql-hackers" Subject: Re: MERGE PARTITIONS and DEPENDS ON EXTENSION. X-Mailer: aerc 0.21.0 References: <31d04a1b-c0cb-4e6f-a344-0db048a3b673@gmail.com> <414c3430-77a9-438e-9dc0-c66033f6be63@postgrespro.ru> <271ebb35-8d8f-41c3-9d95-5c1e5b416216@gmail.com> In-Reply-To: List-Id: List-Help: List-Subscribe: List-Post: List-Owner: List-Archive: Archived-At: Precedence: bulk On Wed Apr 22, 2026 at 7:59 AM -03, Kirill Reshke wrote: > On Wed, 22 Apr 2026 at 15:58, Matheus Alcantara > wrote: >> >> On Wed Apr 22, 2026 at 7:48 AM -03, Kirill Reshke wrote: >> >> +-- An index created directly on a partition has no parent in the par= titioned >> >> +-- index tree; merge must ignore such indexes (they disappear with t= he old >> >> +-- partition). >> >> +CREATE INDEX part_extdep_3_extra_idx ON part_extdep_3(x); >> >> +ALTER TABLE part_extdep MERGE PARTITIONS (part_extdep_merged, part_e= xtdep_3) >> >> + INTO part_extdep_merged2; >> >> +SELECT relname FROM pg_class >> >> +WHERE relname LIKE 'part_extdep_merged2%idx' ORDER BY relname; >> > >> > Looks like this test is also redundant? This does not test new DEPENDS= ON logic. >> > >> >> I think that this test is useful to ensure that we correctly skip such >> indexes created directly on a specific partition. Perhaps we can include >> an ALTER INDEX ... DEPENDS ON for this specific index to make it more >> consistent with the other tests? > > This test is maybe useful, but this is unrelated to what this thread & > fix is about, for my taste. > On collectPartitionIndexExtDeps() we have: if (!get_rel_relispartition(indexOid)) continue; parentIndexOid =3D get_partition_parent(indexOid, true); if (!OidIsValid(parentIndexOid)) continue; I think that this test ensure that get_rel_relispartition() check is called, otherwise we will call get_partition_parent() with an index that don't have parent which will fail with an elog(ERROR). It can be unrelated but I think that it ensure correctness for this fix, or I'm missing something here? -- Matheus Alcantara EDB: https://www.enterprisedb.com