Re: [Patch] Block ALTER TABLE RENAME COLUMN when column is used by property graph

From: SATYANARAYANA NARLAPURAM <satyanarlapuram(at)gmail(dot)com>
To: Ashutosh Bapat <ashutosh(dot)bapat(dot)oss(at)gmail(dot)com>
Cc: PostgreSQL Hackers <pgsql-hackers(at)lists(dot)postgresql(dot)org>
Subject: Re: [Patch] Block ALTER TABLE RENAME COLUMN when column is used by property graph
Date: 2026-04-23 07:39:01
Message-ID: CAHg+QDdYq0NNF2ueLd1Hvn2njtJL2-MONd-=6REM6_4fHRTnhQ@mail.gmail.com
Views: Whole Thread | Raw Message | Download mbox | Resend email
Thread:
Lists: pgsql-hackers

Hi

On Thu, Apr 23, 2026 at 12:33 AM Ashutosh Bapat <
ashutosh(dot)bapat(dot)oss(at)gmail(dot)com> wrote:

> On Thu, Apr 23, 2026 at 12:23 PM SATYANARAYANA NARLAPURAM
> <satyanarlapuram(at)gmail(dot)com> wrote:
> >
> > Hi hackers,
> >
> > When a table column is referenced by a property graph, the property
> > name stored in pg_propgraph_property.pgpname would become stale after
> > a column rename. This caused GRAPH_TABLE queries to fail with the new
> > column name ("property does not exist") while the old (dead) name
> > continued to work. pg_get_propgraphdef() would also emit confusing
> > output like "new_col AS old_col".
>
> This behaviour is inline with the behaviour of view.
>
> #create view vt as select a from t1;
> CREATE VIEW
> #\d+ vt
> View "public.vt"
> Column | Type | Collation | Nullable | Default | Storage | Description
> --------+---------+-----------+----------+---------+---------+-------------
> a | integer | | | | plain |
> View definition:
> SELECT a
> FROM t1;
>
> #alter table t1 rename column a TO aa;
> ALTER TABLE
> #\d+ vt
> View "public.vt"
> Column | Type | Collation | Nullable | Default | Storage | Description
> --------+---------+-----------+----------+---------+---------+-------------
> a | integer | | | | plain |
> View definition:
> SELECT aa AS a
> FROM t1;
>
> Name of the property is derived from the name of the column it
> references if the property name is not specified at the time of
> creating the property. But these two are different. Changing column
> name can not be expected to change the property name automatically. If
> two elements have the same label, the set of property names associated
> with that label is expected to be the same for those two elements as
> well.

Ashutosh, should we document this or it is a well known fact and not
needed? Asking in the context of Graphs, not views.

Thanks,
Satya

In response to

Responses

Browse pgsql-hackers by date

  From Date Subject
Next Message Michael Paquier 2026-04-23 07:44:06 Re: Fix memory leak in postmasterMain
Previous Message David Geier 2026-04-23 07:34:20 Re: Add pg_stat_vfdcache view for VFD cache statistics