Re: BUG #14867: Cascade drop type error
Tom Lane <tgl@sss.pgh.pa.us>
From: Tom Lane <tgl@sss.pgh.pa.us>
To: gomer94@yandex.ru
Cc: pgsql-bugs@postgresql.org
Date: 2017-10-23T16:09:24Z
Lists: pgsql-bugs
gomer94@yandex.ru writes: > CREATE TYPE my_type AS (f1 integer); > CREATE TYPE my_type_2 AS (f2 my_type); > CREATE TABLE my_table (c1 my_type_2); > CREATE VIEW my_view AS SELECT ((C1).f2).f1 FROM my_table; > DROP TYPE my_type CASCADE; Cute. Type my_type isn't exposed as a dependency of the view, because it's only referenced internally in the expression tree not as a result column type. We can fix that easily enough by teaching dependency.c to log the result type of a FieldSelect as a dependency. That results in dropping the whole view, not just one column: regression=# DROP TYPE my_type CASCADE; NOTICE: drop cascades to 2 other objects DETAIL: drop cascades to composite type my_type_2 column f2 drop cascades to view my_view DROP TYPE which is a bit annoying but I think there's no help for it. We don't have logic that could rip apart the view query and reconstruct it without the expression for that one column. regards, tom lane
Commits
-
Fix some oversights in expression dependency recording.
- dde99de1169e 9.3.20 landed
- 900a9fd64a0c 9.2.24 landed
- f3ea3e3e820b 11.0 landed
- df4aa6e4e874 10.1 landed
- d8a3be52f44d 9.4.15 landed
- aa0518301fd8 9.5.10 landed
- 285b850d518d 9.6.6 landed