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 1vzz56-001VJ6-04 for pgsql-hackers@arkaria.postgresql.org; Tue, 10 Mar 2026 15:33:12 +0000 Received: from localhost ([127.0.0.1] helo=malur.postgresql.org) by malur.postgresql.org with esmtp (Exim 4.96) (envelope-from ) id 1vzz54-004Ifr-0t for pgsql-hackers@arkaria.postgresql.org; Tue, 10 Mar 2026 15:33:10 +0000 Received: from magus.postgresql.org ([2a02:c0:301:0:ffff::29]) by malur.postgresql.org with esmtps (TLS1.3) tls TLS_ECDHE_RSA_WITH_AES_256_GCM_SHA384 (Exim 4.96) (envelope-from ) id 1vzz53-004Ifa-36 for pgsql-hackers@lists.postgresql.org; Tue, 10 Mar 2026 15:33:10 +0000 Received: from mail-oo1-xc30.google.com ([2607:f8b0:4864:20::c30]) by magus.postgresql.org with esmtps (TLS1.3) tls TLS_ECDHE_RSA_WITH_AES_128_GCM_SHA256 (Exim 4.98.2) (envelope-from ) id 1vzz52-00000001zLc-01ht for pgsql-hackers@lists.postgresql.org; Tue, 10 Mar 2026 15:33:09 +0000 Received: by mail-oo1-xc30.google.com with SMTP id 006d021491bc7-67baebf716bso1190497eaf.3 for ; Tue, 10 Mar 2026 08:33:07 -0700 (PDT) ARC-Seal: i=1; a=rsa-sha256; t=1773156786; cv=none; d=google.com; s=arc-20240605; b=lw1nYBuNQgvSCFcZ6FJXWz/TEf7F8LrLTobuWt6i+E2wgVIJ7NZ71x1ySUA9VlrpIe 4KcyO05sjldQJZsEbQDwk5Y+1yX7RqWrtQefZunSrrMre3PFpdA4g7FL4dxVxy4LxLZ6 v1frayGFDEiDGDogRBhYrJYyOoZZedgy9rf0gjpujFKJrocL3gp9CcB/lpgyck5u3Yz8 lRImwKmFEqF/uBE+tfYvjVo38uvlg3pZHaGqfYVU+bQzpX6d57yzryDafGBZ3GKP4O5P u1f6MT0jM1ngvj0CwGLStFjMv8AV9tB5mtxslZBQTcCassRFmpJ1O3RhXCGoTHtEzJRf dqAw== ARC-Message-Signature: i=1; a=rsa-sha256; c=relaxed/relaxed; d=google.com; s=arc-20240605; h=cc:to:subject:message-id:date:from:in-reply-to:references :mime-version:dkim-signature; bh=jxgCpAJOTH5zah47dKvV6RlzAI3yfGG5MbFZmB8BANw=; fh=tCw5F7KQYXLmg13CyNf5YJ3yGJX/nVzKlWKPMmgoNCU=; b=Xh8t9i5GDv1RXNINe7qDU6rXZg+reXrk9aDp7UlpqHy228+Yuns/Ua1KdU1GrGU031 3uDrajE7of/ZV+I30UdWzfuO5djhvmOXLPh0B/RcB35/gZoMV29YkkKUD6ddUmhROaDi +1MDlHqWeABHrz3L33vATbylsin6ipYQmoQZc3aT7O1JAOweC3Yfx4F6HyMTTKFTbhib OtoQodW1loqN8Lm+l283ARuEOg5Fn/r4QR/y1Cp4ODs08cPTHZhRrn6YfsawHXTVODtq ngx6qWLRQyS/H1thMFXKqq3ie9YVj4KFyOtly+0FojgjQbZN2SCQjeMIPxv5LtSsLIif P6kA==; darn=lists.postgresql.org ARC-Authentication-Results: i=1; mx.google.com; arc=none DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=gmail.com; s=20230601; t=1773156786; x=1773761586; darn=lists.postgresql.org; h=cc:to:subject:message-id:date:from:in-reply-to:references :mime-version:from:to:cc:subject:date:message-id:reply-to; bh=jxgCpAJOTH5zah47dKvV6RlzAI3yfGG5MbFZmB8BANw=; b=KuuKg15h1uKjeZPt1xZZ4+rFXUGsMwEDwL2HapVfka2LGZS0C9rEk0mivOuUaK3TAq CtR1LbWJmSVtS3DDDH0ZVzkrpn/zZbXCyButEL4sA0KXrbEN5IVG0ZXblIXeOIL7pCcO cQntRp9JnVvt5Eprbdg/ol9hUXJUa7637jTmhOLzfalPOIrHMs1zy+DWvuRFPTUFFYRC BecIi+n0zQNUWKIsdiEyhxadEgzCThqIR04oC3jRW76fW/s8JO+e6snGDVPQbmPdMT1f KCkvbI/7Kw1/JRV6reEXIsm1aoDI2m8nB3X5YgQz1hNSJUsdULC+WJlFDzwieWMrjg3h OTsQ== X-Google-DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=1e100.net; s=20230601; t=1773156786; x=1773761586; h=cc:to:subject:message-id:date:from:in-reply-to:references :mime-version:x-gm-gg:x-gm-message-state:from:to:cc:subject:date :message-id:reply-to; bh=jxgCpAJOTH5zah47dKvV6RlzAI3yfGG5MbFZmB8BANw=; b=BlOLcQ9ABNUWOX+uDaaMcnwPFt3h/Ci065k0bjznHfC5IDwqoRyvrKBiNkUG9drhZK 72NbH5pllw+34g+vZzz1LX41vRAYMa6alcOseWQ+wRMmEMIkByY/FbLtuRKpDAYACCnV vCp9pFOXVzJw+WZzZCW7UaaSGEMX7HGRyd+MYgEmr8M6GZ3WGOZTfvKHFVz75IsvLWtz op4u44wjaSH7KurYjQA9i82MFdWetYb9FLatVGta6VgnRkxh1yxftxWTfDvnrFSG4QZ5 Ao3y455Fo4gPQIKSnrSwsdCdosKnqDE1DDZP6EU+l7TC7hH1PLXW3sKNybQaVbikDagd EN8A== X-Forwarded-Encrypted: i=1; AJvYcCVfkZva88xWkDwdaq8FNIblITXnQ/aNEE8kDq2CPwfVBhNDeF6hxql/iljH8nw2k7pODYADtKOmind5K1AJ@lists.postgresql.org X-Gm-Message-State: AOJu0Yx6KDWg2SzwgfkNN21mRUv2UOBl8dYU9cI2VrD8YePoxnrtP3tW P+SOJy7J03wF6dLWaiSYXXRrEMsM8KNTJifo8+wwXoD8pqqivt9d1gdmsx+yAc+Hm0p0RipsGVA qEngEX2EqDqKt/jJ1zqKXtGuj2ShBjkg= X-Gm-Gg: ATEYQzxSkQBzcul3tpFFIP+6jqxYzR5tBFUQ0tROgTFMnLqFljvb/IGSfxNTomjJV7a G8FiF5MLnz1EO633kDx4gfSJIe3+Ftq6QKKqUNY/+QPCQMBU/G5Cf6NUKl5jixrq8FZMVus9FeP SA5whUi9arf8KKpAzCXhKbzM+qFQrFXbIEkI+hAfbmVF00qwBRSv2oaJVktDA9+Vv2M+J4sRZHL +6QISfNmYX8qjNvoHZKAQNg4TrW75XRl6qStuNBZ6wDfGb8+eUZ0q2/4M3jCez9HCsKOq59r+C3 mGAT+nVl/RpjNNp8FwawiiFK+kofaEh6o76CI+yy X-Received: by 2002:a05:6820:1ca3:b0:67b:aac6:640b with SMTP id 006d021491bc7-67baac665cbmr5993449eaf.26.1773156786110; Tue, 10 Mar 2026 08:33:06 -0700 (PDT) MIME-Version: 1.0 References: <6eff5e43-cacd-4a2a-ad1d-e3b313c86050@uni-muenster.de> <950BB7B5-0180-4C36-82A0-7E17B920F740@gmail.com> <8ECD9403-F0BB-4971-94CF-2709EEB4E3B9@gmail.com> <9174F0CF-2F70-4B4F-AED4-CAF113B7F093@gmail.com> <14669a83-c7b4-4cdf-890c-dceecd025ee1@uni-muenster.de> <3F59D90E-9A47-4C1C-B330-D62D668A462E@gmail.com> <5e01263a-1994-44d5-9e98-7212acf9c985@uni-muenster.de> In-Reply-To: <5e01263a-1994-44d5-9e98-7212acf9c985@uni-muenster.de> From: Greg Sabino Mullane Date: Tue, 10 Mar 2026 11:32:29 -0400 X-Gm-Features: AaiRm51LWC87gKSctqaeT9He6ApE0LZOdklQphVtJSt6JxfGnuSO_6sXwLJ3qjg Message-ID: Subject: Re: ALTER TABLE: warn when actions do not recurse to partitions To: Jim Jones Cc: Chao Li , "David G. Johnston" , Postgres hackers Content-Type: multipart/alternative; boundary="0000000000005e072a064cad3cb8" List-Id: List-Help: List-Subscribe: List-Post: List-Owner: List-Archive: Archived-At: Precedence: bulk --0000000000005e072a064cad3cb8 Content-Type: text/plain; charset="UTF-8" Review of v6: typedef struct partitionNoRecurseNotice > { > List *notices; > } partitionNoRecurseNotice; Not sure why we need a struct here, rather than just passing the list around? Also should be PartitionNoRecurseNotice (CamelCase) foreach(cell, postNotice->notices) > { > if (strcmp((char *) lfirst(cell), notice_msg) == 0) > { > pfree(notice_msg); > found = true; > break; > } > } This seems a lot of extra work that could be avoided. Since we know each message is unique to the cmdtype/AlterTableType and the rel/Relation combination, use those two to drive the duplicate check. Then we can only build the notice_msg if needed! Perhaps adding two more fields to that lonely struct above? partitionNoRecurseNotice * postNotice); postNotice is a little misleading - maybe pending_notices or just notices? does not affect present partitions s/present/existing/g > CollectPartitionNoRecurseNotice(AT_SetSchema, rel, stmt->relation->inh, > false, &postNotice); This hard-coded AT_SetSchema just to return a "SET SCHEMA" later on feels hacky. Don't have a workaround off the top of my head, just registering my mild unease. :) /* Emit a notice only if there are partitions */ > if (nparts == 0) > return; It doesn't look like this particular case is tested. Other than that, the tests look very good. Cheers, Greg --0000000000005e072a064cad3cb8 Content-Type: text/html; charset="UTF-8" Content-Transfer-Encoding: quoted-printable
Review of v6:

typedef struct partitionNoRecurse= Notice
{
=C2=A0 =C2=A0 =C2=A0 =C2=A0List =C2=A0 =C2=A0 =C2=A0 *notice= s;
} =C2=A0 =C2=A0 =C2=A0 =C2=A0 =C2=A0 =C2=A0 =C2=A0 =C2=A0 =C2=A0 =C2= =A0 =C2=A0partitionNoRecurseNotice;
Not sure why= we need a struct here, rather than just passing the list around?

Also should be PartitionNoRecurseNotice (CamelCase)

=C2=A0 =C2= =A0 =C2=A0 =C2=A0 =C2=A0 =C2=A0 =C2=A0 =C2=A0foreach(cell, postNotice->n= otices)
=C2=A0 =C2=A0 =C2=A0 =C2=A0 =C2=A0 =C2=A0 =C2=A0 =C2=A0{
=C2= =A0 =C2=A0 =C2=A0 =C2=A0 =C2=A0 =C2=A0 =C2=A0 =C2=A0 =C2=A0 =C2=A0 =C2=A0 = =C2=A0if (strcmp((char *) lfirst(cell), notice_msg) =3D=3D 0)
=C2=A0 =C2= =A0 =C2=A0 =C2=A0 =C2=A0 =C2=A0 =C2=A0 =C2=A0 =C2=A0 =C2=A0 =C2=A0 =C2=A0{<= br>=C2=A0 =C2=A0 =C2=A0 =C2=A0 =C2=A0 =C2=A0 =C2=A0 =C2=A0 =C2=A0 =C2=A0 = =C2=A0 =C2=A0 =C2=A0 =C2=A0 =C2=A0 =C2=A0pfree(notice_msg);
=C2=A0 =C2= =A0 =C2=A0 =C2=A0 =C2=A0 =C2=A0 =C2=A0 =C2=A0 =C2=A0 =C2=A0 =C2=A0 =C2=A0 = =C2=A0 =C2=A0 =C2=A0 =C2=A0found =3D true;
=C2=A0 =C2=A0 =C2=A0 =C2=A0 = =C2=A0 =C2=A0 =C2=A0 =C2=A0 =C2=A0 =C2=A0 =C2=A0 =C2=A0 =C2=A0 =C2=A0 =C2= =A0 =C2=A0break;
=C2=A0 =C2=A0 =C2=A0 =C2=A0 =C2=A0 =C2=A0 =C2=A0 =C2=A0= =C2=A0 =C2=A0 =C2=A0 =C2=A0}
=C2=A0 =C2=A0 =C2=A0 =C2=A0 =C2=A0 =C2=A0 = =C2=A0 =C2=A0}

This seems a lot of extra wo= rk that could be avoided. Since we know each message is unique to the cmdty= pe/AlterTableType and the rel/Relation combination, use those two to drive = the duplicate check. Then we can only build the notice_msg if needed! Perha= ps adding two more fields to that lonely struct above?

=
=C2=A0partitionNoRecurseN= otice * postNotice);

postNotice is a little= misleading - maybe pending_notices or just notices?

does not affect present par= titions

s/present/existing/g
=C2= =A0
=C2=A0 Col= lectPartitionNoRecurseNotice(AT_SetSchema, rel, stmt->relation->inh, = false, &postNotice);

This hard-coded AT= _SetSchema just to return a "SET SCHEMA" later on feels hacky. Do= n't have a workaround off the top of my head, just registering my mild = unease. :)=C2=A0

=C2=A0 =C2=A0 =C2=A0 =C2=A0 =C2=A0 =C2=A0 =C2=A0 =C2=A0/* Emit = a notice only if there are partitions */
=C2=A0 =C2=A0 =C2=A0 =C2=A0 =C2= =A0 =C2=A0 =C2=A0 =C2=A0if (nparts =3D=3D 0)
=C2=A0 =C2=A0 =C2=A0 =C2=A0= =C2=A0 =C2=A0 =C2=A0 =C2=A0 =C2=A0 =C2=A0 =C2=A0 =C2=A0return;

It doesn't look like this particular case is teste= d. Other than that, the tests look very good.


=
Chee= rs,
Greg


--0000000000005e072a064cad3cb8--