[Bug] UPDATE of the distribution key fails with "can't split update for inherit table" after the child table is dropped
まだ誰も着手していません。
評価
- 難易度
- 3/5
- 見積もり時間
- 1〜2日
- 初心者へのやさしさ
- 65/100
調査の方向性
The bug is in the Postgres planner code, likely in preptlist.c line 140. Start by examining the function that checks for inheritance children before splitting an UPDATE on a distribution key. Look at how relhassubclass is used versus find_inheritance_children() or pg_inherits. The fix should replace the hint check with a direct lookup of actual children. Run the provided reproduction script to verify the error and that ANALYZE clears it. Test with optimizer=off to ensure the fix works for the Postgres planner.
索引モデルが issue の本文から書いたものです。
説明
Apache Cloudberry version
main; REL_2_STABLE
What happened
UPDATE of a distribution-key column is rejected for a table that has inheritance children:
ERROR: can't split update for inherit table: pinh (preptlist.c:140)
The error persists after all child tables are dropped. The check relies on pg_class.relhassubclass, which PostgreSQL does not clear when the last child is dropped; only ANALYZE or VACUUM clears it lazily. As a result, a plain table with no children refuses to update its distribution key until somebody runs ANALYZE on it.
On REL_2_STABLE, this happens with the Postgres planner (optimizer = off). With GPORCA, the same UPDATE after DROP TABLE cinh succeeds.
What you think should happen instead
Once the table has no inheritance children, updating its distribution key should work as it does for any other table. The check should look at the actual children (for example find_inheritance_children() / pg_inherits), not at relhassubclass, which is only a hint.
How to reproduce
create table pinh(a int, b int) distributed by (b);
create table cinh() inherits (pinh);
insert into pinh values (1,1);
update pinh set a = a + 1; -- OK, not a distribution key
update pinh set b = b + 1; -- ERROR: can't split update for inherit table: pinh
drop table cinh;
select count(*) from pg_inherits where inhparent = 'pinh'::regclass; -- 0, no children
select relhassubclass from pg_class where oid = 'pinh'::regclass; -- t, stale flag
update pinh set b = b + 1; -- still ERROR: can't split update for inherit table: pinh
analyze pinh;
select relhassubclass from pg_class where oid = 'pinh'::regclass; -- f
update pinh set b = b + 1; -- UPDATE 1
Operating System
any
Anything else
No response
Are you willing to submit PR?
- Yes, I am willing to submit a PR!
Code of Conduct
- I agree to follow this project's Code of Conduct.
- 主要言語
- C
- スター
- 1.4k
- フォーク
- 248
- 平均マージ
- 4日 10時間
- マージ済み PR(30日)
- 40
コントリビューションガイド
はじめの一歩
- issue を最後まで読み、次にプロジェクトのコントリビューションガイドを読みます。
- 着手することを issue にコメントします — 二人が同じ作業をするのを防げます。
- リポジトリをフォークし、ブランチを切って変更します。
- issue 番号を参照したプルリクエストを送ります。
apache/cloudberry のほかの issue
-
type: Bug
難易度 2/5 1〜3時間 初心者へのやさしさ 76/100
apache/cloudberry#1885 · リアクション 2 件 ·
-
難易度 2/5 1〜3時間 初心者へのやさしさ 86/100
apache/cloudberry#1825 ·
-
type: Bug
難易度 4/5 3〜5日 初心者へのやさしさ 40/100
apache/cloudberry#2047 ·
-
type: Bug
難易度 4/5 3〜5日 初心者へのやさしさ 45/100
apache/cloudberry#2046 · コメント 1 件 ·
-
type: Bug
難易度 4/5 3〜5日 初心者へのやさしさ 52/100
apache/cloudberry#2026 · コメント 1 件 · リアクション 1 件 ·
apache/cloudberry の issue をすべて見る
似ている issue
-
bug
難易度 2/5 1〜3時間 初心者へのやさしさ 75/100
bradcypert/plum#53 ·
-
Component: GLib
難易度 2/5 1〜3時間 初心者へのやさしさ 70/100
-
難易度 2/5 1〜3時間 初心者へのやさしさ 75/100
-
Status: Opened
難易度 2/5 1〜3時間 初心者へのやさしさ 70/100
-
難易度 2/5 1〜3時間 初心者へのやさしさ 75/100
nextbsd/nextbsd-userland#285 ·