BUG #17439: DROP FUNCTION functionName(); drops associated generated column without using CASCADE

From: PG Bug reporting form <noreply(at)postgresql(dot)org>
To: pgsql-bugs(at)lists(dot)postgresql(dot)org
Cc: kmanh999(at)gmail(dot)com
Subject: BUG #17439: DROP FUNCTION functionName(); drops associated generated column without using CASCADE
Date: 2022-03-15 15:11:17
Message-ID: 17439-7df4421197e928f0@postgresql.org
Views: Raw Message | Whole Thread | Download mbox | Resend email
Thread:
Lists: pgsql-bugs

The following bug has been logged on the website:

Bug reference: 17439
Logged by: Kevin Humphreys
Email address: kmanh999(at)gmail(dot)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.

Responses

Browse pgsql-bugs by date

  From Date Subject
Next Message PG Bug reporting form 2022-03-15 16:58:59 BUG #17440: not expected result from jsonb_path_query
Previous Message Kyotaro Horiguchi 2022-03-15 02:33:33 Re: BUG #17385: "RESET transaction_isolation" inside serializable transaction causes Assert at the transaction end