Received: from malur.postgresql.org ([217.196.149.56]) by arkaria.postgresql.org with esmtp (Exim 4.84_2) (envelope-from ) id 1e6fJ2-0005Qm-3S for pgsql-bugs@arkaria.postgresql.org; Mon, 23 Oct 2017 16:10:24 +0000 Received: from localhost ([127.0.0.1] helo=postgresql.org) by malur.postgresql.org with smtp (Exim 4.84_2) (envelope-from ) id 1e6fJ1-00019S-5z for pgsql-bugs@arkaria.postgresql.org; Mon, 23 Oct 2017 16:10:23 +0000 Received: from magus.postgresql.org ([2a02:c0:301:0:ffff::29]) by malur.postgresql.org with esmtps (TLS1.2:ECDHE_RSA_AES_256_CBC_SHA384:256) (Exim 4.84_2) (envelope-from ) id 1e6fIE-00088K-9g for pgsql-bugs@postgresql.org; Mon, 23 Oct 2017 16:09:34 +0000 Received: from sss.pgh.pa.us ([66.207.139.130]) by magus.postgresql.org with esmtps (TLS1.2:ECDHE_RSA_AES_256_CBC_SHA384:256) (Exim 4.84_2) (envelope-from ) id 1e6fI7-0007Vz-94 for pgsql-bugs@postgresql.org; Mon, 23 Oct 2017 16:09:33 +0000 Received: from sss1.sss.pgh.pa.us (localhost [127.0.0.1]) by sss.pgh.pa.us (8.14.4/8.14.4) with ESMTP id v9NG9OBS004422; Mon, 23 Oct 2017 12:09:24 -0400 From: Tom Lane To: gomer94@yandex.ru cc: pgsql-bugs@postgresql.org Subject: Re: BUG #14867: Cascade drop type error In-reply-to: <20171023150118.1477.19174@wrigleys.postgresql.org> References: <20171023150118.1477.19174@wrigleys.postgresql.org> Comments: In-reply-to gomer94@yandex.ru message dated "Mon, 23 Oct 2017 15:01:18 -0000" MIME-Version: 1.0 Content-Type: text/plain; charset="us-ascii" Content-ID: <4420.1508774964.1@sss.pgh.pa.us> Date: Mon, 23 Oct 2017 12:09:24 -0400 Message-ID: <4421.1508774964@sss.pgh.pa.us> List-Archive: List-Help: List-ID: List-Owner: List-Post: List-Subscribe: List-Unsubscribe: X-Mailing-List: pgsql-bugs Precedence: bulk Sender: pgsql-bugs-owner@postgresql.org 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 -- Sent via pgsql-bugs mailing list (pgsql-bugs@postgresql.org) To make changes to your subscription: http://www.postgresql.org/mailpref/pgsql-bugs