Removing a parent from "Inherited from" hides its columns in the grid, but Save doesn't drop them
I maintainer di solito rispondono entro 1 giorno
Valutazione
- Difficoltà
- 3/5
- Tempo stimato
- 1-2 giorni
- Idoneità per principianti
- 35/100
Direzione di ricerca
Read tables/utils.py around _check_for_column_delete and trace how coll_inherits_removed reaches it; compare with the removal logic in table.ui.js and SQL generation in templates/tables/sql/default/update.sql. Check how columns shared with a remaining parent are identified. Done means the generated SQL drops columns from removed parents after NO INHERIT, preserves columns still inherited elsewhere, and the reported reproduction works.
Scritto dal modello di indicizzazione a partire dal testo della issue.
Descrizione
Please note that security bugs or issues should be reported to [email protected].
Describe the bug
After the #10470 fix, removing a parent from "Inherited from" in a saved table's Properties dialog correctly removes that parent's columns from the Columns grid. But Save only runs ALTER TABLE ... NO INHERIT ... and never drops those columns. PostgreSQL keeps them on the child as ordinary columns, so when you reopen Properties they are back and editable. The removal shown in the dialog is never saved.
To Reproduce
Steps to reproduce the behavior:
- Create the tables (I created them through the Create Table dialog; this is the SQL it generated):
CREATE TABLE public.parent ( id bigint, name "char" ); CREATE TABLE public.child ( model "char" ) INHERITS (public.parent); - Open Properties for
childand go to the Columns tab.idandnameare shown as inherited (read-only). - Remove
public.parentfrom "Inherited from".idandnamedisappear from the grid; onlymodelis left. - Open the SQL tab. It contains only:
ALTER TABLE IF EXISTS public.child NO INHERIT public.parent; - Click Save, then reopen Properties for
child. idandnameare listed again, now as normal editable columns.
Expected behavior
Saving should apply what the grid shows. The columns contributed by the removed parent should be dropped from the child, so after reopening only model is left. The generated SQL should be:
ALTER TABLE IF EXISTS public.child
NO INHERIT public.parent;
ALTER TABLE IF EXISTS public.child DROP COLUMN IF EXISTS id;
ALTER TABLE IF EXISTS public.child DROP COLUMN IF EXISTS name;
Columns that another remaining parent still provides should not be dropped.
Error message
N/A. No error is raised.
Screenshots
N/A
Desktop (please complete the following information):
- OS: macOS 26.7
- pgAdmin version: 9.18 (master @ a623526cb)
- Mode: Server
- Browser (if running in server mode): Chrome
- Package type: Python (source, Python 3.9.6)
Additional context
The save request (PUT /browser/table/obj/1/1/<did>/2200/<tid>) sends the removed columns as deleted, still tagged with the removed parent (payload trimmed):
{
"columns": {
"deleted": [
{"name": "id", "attnum": 1, "cltype": "bigint",
"inheritedfrom": "public.parent", "inheritedid": 21412,
"inheritedfromtable": "public.parent"},
{"name": "name", "attnum": 2, "cltype": "\"char\"",
"inheritedfrom": "public.parent", "inheritedid": 21412,
"inheritedfromtable": "public.parent"}
]
},
"coll_inherits": [],
"oid": 21415
}
Follow-up to #10470 / #10504 (bdb652b77). Together with #10534 (0cbddf21b), those changes made reopened columns carry inheritedid, so the dialog now removes them from the grid. The save path was not updated to match:
table.ui.js, thecoll_inheritsdeferredDepChange"Remove columns logic" (~L689-L710): removes the parent's columns from the grid, so they are sent ascolumns.deleted.tables/utils.py,_check_for_column_delete(~L1289-L1300): skipsDROP COLUMNfor any deleted column that hasinheritedfromset, so these columns produce no SQL.templates/tables/sql/default/update.sql(~L38-L44): emits onlyNO INHERIT, and PostgreSQL keeps the columns as local columns (see theALTER TABLE ... NO INHERITdocs).
Suggested fix: in _check_for_column_delete, also emit DROP COLUMN for deleted columns whose parent is in coll_inherits_removed. The table-level SQL (including NO INHERIT) is already generated before the column SQL in get_sql, so the drop runs after the column is no longer inherited. Columns still provided by another remaining parent must be excluded: the grid matches on the first parent's inheritedid only, and dropping such a column would fail with cannot drop inherited column.
- Lingua principale
- Python
- Stelle
- 3.9k
- Fork
- 910
- Merge medio
- 1g 16h
- PR unite (30g)
- 41
Preparare l'ambiente
- Include un Dockerfile o un file Docker Compose
- Nessun modello di pull request
- Leggi la guida per i contributori
Come iniziare
- Leggi tutta la issue e poi la guida ai contributi del progetto.
- Commenta sulla issue per dire che te ne occupi tu — evita che due persone facciano lo stesso lavoro.
- Fai un fork del repository e lavora su un branch.
- Apri una pull request che faccia riferimento al numero della issue.
Altre issue di pgadmin-org/pgadmin4
-
Helm chart: allow setting ingressClassName on the IngressForse già presa @commarla l’ha presa oggi. Aperta
Difficoltà 2/5 1-3 ore Idoneità per principianti 85/100
pgadmin-org/pgadmin4#10658 ·
I maintainer di solito rispondono entro 1 giorno
-
Feature
Difficoltà 2/5 1-3 ore Idoneità per principianti 78/100
pgadmin-org/pgadmin4#10426 · 3 commenti · 1 reazione ·
I maintainer di solito rispondono entro 1 giorno
-
Feature
Difficoltà 2/5 1-3 ore Idoneità per principianti 68/100
pgadmin-org/pgadmin4#10272 · 5 commenti ·
I maintainer di solito rispondono entro 1 giorno
-
Housekeeping
Difficoltà 2/5 1-3 ore Idoneità per principianti 76/100
pgadmin-org/pgadmin4#10157 · 1 commento ·
I maintainer di solito rispondono entro 1 giorno
-
Difficoltà 5/5 Più di una settimana Idoneità per principianti 1/100
pgadmin-org/pgadmin4#10656 ·
I maintainer di solito rispondono entro 1 giorno
Tutte le issue di pgadmin-org/pgadmin4
Issue simili
-
Difficoltà 2/5 1-3 ore Idoneità per principianti 77/100
khuisman/mcp-gee-sweet#1166 ·
I maintainer di solito rispondono entro 1 giorno
-
bug
Difficoltà 2/5 1-3 ore Idoneità per principianti 70/100
lugassawan/swe-workbench#823 ·
I maintainer di solito rispondono entro 1 giorno
-
Difficoltà 2/5 1-3 ore Idoneità per principianti 85/100
gramaziokohler/compas_timber#870 ·
-
security-scan-failure
Difficoltà 2/5 1-3 ore Idoneità per principianti 78/100
semantica-agi/semantica#2089 ·
I maintainer di solito rispondono entro 1 giorno
-
bug
Difficoltà 2/5 1-3 ore Idoneità per principianti 82/100
autowarefoundation/autoware_carla_scenario#500 ·
I maintainer di solito rispondono entro 1 giorno