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 1vdOxh-0006HT-01 for pgsql-hackers@arkaria.postgresql.org; Wed, 07 Jan 2026 08:32:13 +0000 Received: from localhost ([127.0.0.1] helo=malur.postgresql.org) by malur.postgresql.org with esmtp (Exim 4.96) (envelope-from ) id 1vdOxf-00CwBD-2b for pgsql-hackers@arkaria.postgresql.org; Wed, 07 Jan 2026 08:32:12 +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 1vdOtz-00CmAb-1I for pgsql-hackers@lists.postgresql.org; Wed, 07 Jan 2026 08:28:24 +0000 Received: from mail-dl1-x1229.google.com ([2607:f8b0:4864:20::1229]) by makus.postgresql.org with esmtps (TLS1.3) tls TLS_ECDHE_RSA_WITH_AES_128_GCM_SHA256 (Exim 4.96) (envelope-from ) id 1vdOty-004gN4-1m for pgsql-hackers@lists.postgresql.org; Wed, 07 Jan 2026 08:28:23 +0000 Received: by mail-dl1-x1229.google.com with SMTP id a92af1059eb24-121b14d0089so1302519c88.0 for ; Wed, 07 Jan 2026 00:28:22 -0800 (PST) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=gmail.com; s=20230601; t=1767774501; x=1768379301; darn=lists.postgresql.org; h=to:references:message-id:content-transfer-encoding:cc:date :in-reply-to:from:subject:mime-version:from:to:cc:subject:date :message-id:reply-to; bh=4KbUUTFHhqEMhEofip+X83F5ZbiRooWN868FUT2GkI8=; b=dOvovirAZvK0w41kxY6ZRn0Hdr9PmhIdP3WsdDylM+/IwshlZ/2zALa9L0oH9ST5du +pnawY3HN5Ia4MRdkB5Fu5QeDSMLbNRkrICpEfKQXuKDu46GPFRaNtcc3TCdhV43yt6k 2eTJ+zTW82h6QAY3uhBIFSzkkbxDiDNEoWuAdumICd80HMAbq+AiVvfemy95RyrqUrBI IFEovEE9luOeVzwSCvFpYhWAAgv362SXlrqaDjcZNfLMan9QCaB1MI7xV1ve0P1ge8qn Aggf93nOoBCGKZU5TUrA9JFePRC9RkE9Jx4wGcGL/95mdbm6LGal1UJ4VfXEuLwTllQg BofQ== X-Google-DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=1e100.net; s=20230601; t=1767774501; x=1768379301; h=to:references:message-id:content-transfer-encoding:cc:date :in-reply-to:from:subject:mime-version:x-gm-gg:x-gm-message-state :from:to:cc:subject:date:message-id:reply-to; bh=4KbUUTFHhqEMhEofip+X83F5ZbiRooWN868FUT2GkI8=; b=TUOe6joUQZzhZzX/U4WNK5BuWQ1e4T03Eaos8l2O/g+14oQpjSQu4NzHHZTldM/eN9 XGUx6r6J2Zbkb5Ptcnmu+HmISpOLUujtLtmiWtRHRnT7er0M/FTIvgVNy1SS6BDyUdPb IcIyh0+Y+ryP7UV3QhsgPPuKhjjiZsEa8aINgwubwC8GnCCEp2T07DM/Xzdva5qrcxfv TCPfVhz5dSouJYpZ/WHq5TyuJ96R5uJ8sQqnUo4kdipbfRwRpJp97GaPRdSTPrh9H3zj aZqvypXPhQP4SYUeOXuiXAnU3kscle2YuB4nGdXhOjSY9rnyeeKagAn9laGBYZvTC73G FFpg== X-Gm-Message-State: AOJu0Yzq0fRT6jIHwcHKqb1MU4MiW2Xuw9YkMIp79kEJ/bXLEIxT9W+S UY5qgxcIddGNVNBVh7HI2ATcu8hqnaJYOMP3rNeUeGoxug+DGylG86zvi0sjzJH2SKI= X-Gm-Gg: AY/fxX5hFBZ2u6qnozL0NhSieIOzKw6QwJu8653BoGuKLtmxAk/REKu2coJgcMoun2e zyZ7YABq41CtbmGxkxSwCvY/sINQFy24yVNwVyFiZyXZSTBiBDzDB8VyQkPb7O0LyeCNLkvmrTs WPY3fWxVOvi91Sk6c0fGZCR9IK7T5hm05XMhOl5uJlQWFKDKgjNwpwAwseddqaxRYaQbsh51leZ 48hkXlvYESwRokE9OusjFehB4mZP63wjKl3paQ5sKxBaODyyrLezkFC6Wd/YiI+gA8muqIugg+C t7FZKRvLKKfJglXX6nDcfpiEwiTEzhGzjUczK01szsiZmgXVx3evh2fa8FvxQVcS9SI6rOQKgRx ohcE8dz0ryuwKRegrhTwZkURjsS+sM03UzP6cze1qBS18lRa3aRLBn7mDX7axMl6uStayGXGJDF tQp1kmSombI6scXpolpRTNX5lHu8qWTiQ= X-Google-Smtp-Source: AGHT+IGA+GIf8DOOVmAQ2FYY7T3crxabeEZ4yVNvWgmLnVQpJiJLKbIBqxHWhqoaAiZNSYAgBiLt/w== X-Received: by 2002:a05:7022:f90e:b0:11d:f037:891c with SMTP id a92af1059eb24-121f8b993ecmr826320c88.44.1767774500479; Wed, 07 Jan 2026 00:28:20 -0800 (PST) Received: from smtpclient.apple ([142.171.105.12]) by smtp.gmail.com with ESMTPSA id a92af1059eb24-121f248c16fsm9383480c88.10.2026.01.07.00.28.18 (version=TLS1_2 cipher=ECDHE-ECDSA-AES128-GCM-SHA256 bits=128/128); Wed, 07 Jan 2026 00:28:19 -0800 (PST) Content-Type: text/plain; charset=utf-8 Mime-Version: 1.0 (Mac OS X Mail 16.0 \(3826.700.81\)) Subject: Re: docs: clarify ALTER TABLE behavior on partitioned tables From: Chao Li In-Reply-To: Date: Wed, 7 Jan 2026 16:27:45 +0800 Cc: Amit Kapila Content-Transfer-Encoding: quoted-printable Message-Id: <90F9169D-135C-45E5-8221-4F79DAED98E2@gmail.com> References: To: Postgres hackers X-Mailer: Apple Mail (2.3826.700.81) List-Id: List-Help: List-Subscribe: List-Post: List-Owner: List-Archive: Archived-At: Precedence: bulk > On Jan 7, 2026, at 13:59, Chao Li wrote: >=20 > Hi Hackers, >=20 > This task is derived from [1], as =E2=80=9CALTER TABLE=E2=80=9D is = considered to exhibit =E2=80=9Cinconsistent=E2=80=9D behaviors with = partitioned tables. =46rom the current documentation of =E2=80=9CALTER = TABLE=E2=80=9D, readers won=E2=80=99t get enough information to form a = clear understanding of how these commands behave with partitioned = tables, and this gap needs to be addressed. >=20 > I have spent several days verifying sub-commands of =E2=80=9CALTER = TABLE=E2=80=9D one by one against partitioned tables from the following = points: >=20 > 1) Does an action on a parent partitioned table propagate to child = partitions? > 2) Does a value set on a parent partitioned table get automatically = inherited by newly created partitions? > 3) Does =E2=80=9CONLY partitioned-table=E2=80=9D work as the = documentation states (preventing propagation)? > 4) Can an action be performed on a partitioned table and its children = independently? >=20 > =46rom these four criteria, sub-commands fall into the following = categories: >=20 > C1 - Sub-commands that can only be used with a partitioned table; ONLY = will lead to an error; using them with a child partition will lead to an = error. >=20 > * ADD COLUMN > * DROP COLUMN > * SET DATA TYPE > * DROP EXPRESSION > * ADD GENERATED AS IDENTITY > * ADD GENERATED > * DROP IDENTITY > * SET sequence_option > * RESTART > * ALTER CONSTRAINT >=20 >=20 > C2 - Sub-commands where using them with a partitioned table will = automatically propagate to child partitions; ONLY prevents propagation; = new partitions > inherit the parent=E2=80=99s new setting; and child partitions can be = set to different values than the parent. >=20 > * SET DEFAULT > * DROP DEFAULT > * SET EXPRESSION AS > * SET STORAGE > * DROP CONSTRAINT > * ENABLE/DISABLE [ REPLICA | ALWAYS] TRIGGER >=20 > C3 - Slightly different from C2: new partitions will not inherit the = parent=E2=80=99s setting. >=20 > * SET STATISTICS >=20 > C4 - Sub-commands that can be used on a partitioned table and child = partitions independently; actions on the parent will not propagate to = children; children > can have different settings than the parent; new partitions will not = inherit the parent=E2=80=99s setting; ONLY can be used but has no = effect. >=20 > * SET/RESET (attribute_option =3D value) > * ENABLE/DISABLE [ REPLICA | ALWAYS] RULE > * ENABLE/DISABLE ROW LEVEL SECURITY > * NO FORCE / FORCE ROW LEVEL SECURITY > * OWNER TO > * REPLICA IDENTITY > * SET SCHEMA >=20 > C5 - Slightly different from C4: new partitions will automatically = inherit the parent=E2=80=99s setting. >=20 > * SET COMPRESSION >=20 > C6 - Slightly different from C2: ONLY cannot be used with a parent = partitioned table, meaning the setting must be propagated to child = partitions. >=20 > * ADD table_constraint >=20 > C7 - Sub-commands that cannot be used with a partitioned table, but = can only be used with a leaf partition. >=20 > * ADD table_constraint_with_index > * ALTER CONSTRAINT =E2=80=A6 INHERIT / NO INHERIT > * CLUSTER ON > * SET WITHOUT CLUSTER > * SET { LOGGED | UNLOGGED } > * SET (storage_parameter) >=20 >=20 > C8 - Slightly different from C1: child partitions can set different = values than the parent. >=20 > * VALIDATE CONSTRAINT >=20 > C9 - Slightly different from C2: if the parent has a value, then new = partitions will inherit that value; otherwise, they use the default from = the GUC. >=20 > * SET ACCESS METHOD >=20 > C10 - Sub-commands used with a parent partitioned table will NOT = propagate to child partitions; but new partitions will automatically = inherit the parent=E2=80=99s setting; partitions can be set to different = values than the parent; ONLY can be used but has no effect. >=20 > * SET TABLESPACE >=20 > C11 - Sub-commands used with a parent partitioned table won=E2=80=99t = fail but do nothing; using them with a leaf partition works as with a = normal table. >=20 > * RESET (storage_parameter) # this appears questionable, because SET = (storage_parameter) is not allowed on a partitioned table >=20 > C12 - Sub-commands that don=E2=80=99t support partitioned tables; = neither parent partitioned tables nor child partitions. >=20 > * INHERIT parent_table > * NO INHERIT parent_table >=20 > C13 - Sub-commands that support only parent partitioned tables; ONLY = can be used but has no effect; using them with a child partition will = fail. > * OF type > * NOT OF >=20 > C14 - Sub-commands that treat partitioned tables, either parent = partitioned tables or child partitions, as normal tables, so no = propagation occurs; ONLY can be used but has no effect. >=20 > * RENAME >=20 > C15 - Sub-commands that operate on partitioned tables. >=20 > * ATTACH PARTITION > * DETACH PARTITION > * MERGE PARTITIONS > * SPLIT PARTITION >=20 > =E2=80=94 End of categories =E2=80=94 >=20 > With these categories, we can clearly see where =E2=80=9Cinconsistencies= =E2=80=9D exist, and measure whether future changes mitigate these = =E2=80=9Cinconsistencies=E2=80=9D or make them worse. Some categories = include only one or two sub-commands; maybe they can be adjusted to = other categories so that some categories are eliminated and the overall = =E2=80=9Cinconsistency=E2=80=9D situation is improved. >=20 > In this patch, I just want to add clarifications to the =E2=80=9CALTER = TABLE=E2=80=9D documentation, without changing any existing behaviors. >=20 > This patch is pretty massive. Although I have done a self-review, I = may still have missed things. I know this patch is a challenge for = reviewers, so I=E2=80=99m open to any suggestions to make it easier to = review and commit, such as splitting it in some way. >=20 >=20 > [1] = https://postgr.es/m/CAEoWx2nJ71hy8R614HQr7vQhkBReO9AANPODPg0aSQs74eOdLQ@ma= il.gmail.com >=20 > -- > Chao Li (Evan) > HighGo Software Co., Ltd. > https://www.highgo.com/ >=20 >=20 >=20 >=20 > Added to CF: https://commitfest.postgresql.org/patch/6379/ Best regards, -- Chao Li (Evan) HighGo Software Co., Ltd. https://www.highgo.com/