BUG #17439: DROP FUNCTION functionName(); drops associated generated column without using CASCADE - Mailing list pgsql-bugs

From PG Bug reporting form
Subject BUG #17439: DROP FUNCTION functionName(); drops associated generated column without using CASCADE
Date
Msg-id 17439-7df4421197e928f0@postgresql.org
Whole thread Raw
Responses Re: BUG #17439: DROP FUNCTION functionName(); drops associated generated column without using CASCADE  (Tom Lane <tgl@sss.pgh.pa.us>)
List pgsql-bugs
The following bug has been logged on the website:

Bug reference:      17439
Logged by:          Kevin Humphreys
Email address:      kmanh999@gmail.com
PostgreSQL version: 13.3
Operating system:   docker linux
Description:

We have the following DDL

create table schemaA.building
(
    id            integer default
nextval('layer0_data.instance_id_seq'::regclass) not null
        primary key
        unique,
    serial_number text,
    name          text
      not null,
    geometry      geometry(Geometry, 4326)
        constraint geom_check
            check (geometrytype(geometry) = ANY (ARRAY ['POLYGON'::text,
'MULTIPOLYGON'::text, 'POINT'::text])),
    feature_id    integer
        unique
        references route.feature
            on update restrict on delete restrict,
    type          text
      not null
        references layer0_enum.building_type
            on update restrict on delete restrict,
    ownership     text
      not null
        references layer0_enum.building_ownership
            on update restrict on delete restrict,
    height        numeric default 0
      not null,
    length        numeric default 0
      not null,
    width         numeric default 0
      not null,
    import_info   text,
    altname       text,
    iversion      text,
    area          double precision generated always as (map.area(geometry))
stored
);

If I execute `DROP FUNCTION IF EXISTS map.area(geometry)`, it should error
out saying it is depended on by building.area. However, instead it
successfully drops map.area(geometry) and also drops the building.area
column. According to the documentation, RESTRICT is the default so it should
refuse to drop instead of dropping the column unless I explicitly call DROP
using CASCADE.


pgsql-bugs by date:

Previous
From: Kyotaro Horiguchi
Date:
Subject: Re: BUG #17385: "RESET transaction_isolation" inside serializable transaction causes Assert at the transaction end
Next
From: PG Bug reporting form
Date:
Subject: BUG #17440: not expected result from jsonb_path_query