Hacktoberfest 2026: le issue che i maintainer hanno segnato per ottobre, aperte e adatte ai principianti. Sfoglia le issue Hacktoberfest

Removing a parent from "Inherited from" hides its columns in the grid, but Save doesn't drop them

Aperta
#10,657 0 commenti 0 reazioni 0 assegnatari Vedi su GitHub

I maintainer di solito rispondono entro 1 giorno

@VIBVEL47 ci sta già lavorando.

Dal 22/10/2026.

  • #10661 di @VIBVEL47 — aperta

Valutazione

Difficoltà
3/5
Tempo stimato
1-2 giorni
Idoneità per principianti
35/100
Tipo di issue
Bug
Chiarezza
Specificata chiaramente
Stato di attività
Ferma
Stack tecnologico
postgresql, python
Ambito
databases

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

Bug

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:

  1. 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);
    
  2. Open Properties for child and go to the Columns tab. id and name are shown as inherited (read-only).
  3. Remove public.parent from "Inherited from". id and name disappear from the grid; only model is left.
  4. Open the SQL tab. It contains only:
    ALTER TABLE IF EXISTS public.child
        NO INHERIT public.parent;
    
  5. Click Save, then reopen Properties for child.
  6. id and name are 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, the coll_inherits deferredDepChange "Remove columns logic" (~L689-L710): removes the parent's columns from the grid, so they are sent as columns.deleted.
  • tables/utils.py, _check_for_column_delete (~L1289-L1300): skips DROP COLUMN for any deleted column that has inheritedfrom set, so these columns produce no SQL.
  • templates/tables/sql/default/update.sql (~L38-L44): emits only NO INHERIT, and PostgreSQL keeps the columns as local columns (see the ALTER TABLE ... NO INHERIT docs).

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

Come iniziare

  1. Leggi tutta la issue e poi la guida ai contributi del progetto.
  2. Commenta sulla issue per dire che te ne occupi tu — evita che due persone facciano lo stesso lavoro.
  3. Fai un fork del repository e lavora su un branch.
  4. Apri una pull request che faccia riferimento al numero della issue.

Altre issue di pgadmin-org/pgadmin4

Tutte le issue di pgadmin-org/pgadmin4

Issue simili

Altre issue su Python

Ricevi le nuove issue nella tua casella

Un breve riepilogo di issue GitHub adatte ai principianti.