pg.ddx.io  pgsql-bugs@postgresql.org mailing list archive  
help / color / mirror / Atom feed
From: PG Bug reporting form <noreply@postgresql.org>
To: pgsql-bugs@lists.postgresql.org
Cc: kmanh999@gmail.com
Subject: BUG #17439: DROP FUNCTION functionName(); drops associated generated column without using CASCADE
Date: Tue, 15 Mar 2022 15:11:17 +0000
Message-ID: <17439-7df4421197e928f0@postgresql.org> (raw)

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.



view thread (9+ messages)  latest in thread

Message-ID: <17439-7df4421197e928f0@postgresql.org>
Permalink:  ../17439-7df4421197e928f0@postgresql.org/
Also on:    postgresql.org/message-id/17439-7df4421197e928f0@postgresql.org

 · 

reply

Reply instructions:

You may reply publicly to this message via plain-text email
using any one of the following methods:

* Reply to all the recipients using the --to and --cc options:
  reply via email

  To: pgsql-bugs@postgresql.org
  Cc: noreply@postgresql.org, pgsql-bugs@lists.postgresql.org, kmanh999@gmail.com
  Subject: Re: BUG #17439: DROP FUNCTION functionName(); drops associated generated column without using CASCADE
  In-Reply-To: <17439-7df4421197e928f0@postgresql.org>

* Save the following mbox file, import it into your mail client,
  and reply-to-all from there: mbox

This inbox is served by DDX for PostgreSQL; see mirroring instructions
for how to clone and mirror all data and code used for this inbox