Received: from malur.postgresql.org ([217.196.149.56]) by arkaria.postgresql.org with esmtps (TLS1.3:ECDHE_RSA_AES_256_GCM_SHA384:256) (Exim 4.92) (envelope-from ) id 1opsMM-0004OV-DE for pgsql-general@arkaria.postgresql.org; Tue, 01 Nov 2022 14:35:22 +0000 Received: from localhost ([127.0.0.1] helo=malur.postgresql.org) by malur.postgresql.org with esmtp (Exim 4.92) (envelope-from ) id 1opsMK-0007gi-NV for pgsql-general@arkaria.postgresql.org; Tue, 01 Nov 2022 14:35:20 +0000 Received: from magus.postgresql.org ([2a02:c0:301:0:ffff::29]) by malur.postgresql.org with esmtps (TLS1.3:ECDHE_RSA_AES_256_GCM_SHA384:256) (Exim 4.92) (envelope-from ) id 1opsMJ-0007g1-Ip for pgsql-general@lists.postgresql.org; Tue, 01 Nov 2022 14:35:20 +0000 Received: from wout5-smtp.messagingengine.com ([64.147.123.21]) by magus.postgresql.org with esmtps (TLS1.3:ECDHE_RSA_AES_256_GCM_SHA384:256) (Exim 4.92) (envelope-from ) id 1opsMF-00056Y-T5 for pgsql-general@postgresql.org; Tue, 01 Nov 2022 14:35:19 +0000 Received: from compute2.internal (compute2.nyi.internal [10.202.2.46]) by mailout.west.internal (Postfix) with ESMTP id 4597B320098D; Tue, 1 Nov 2022 10:35:12 -0400 (EDT) Received: from mailfrontend1 ([10.202.2.162]) by compute2.internal (MEProxy); Tue, 01 Nov 2022 10:35:12 -0400 DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=aklaver.com; h= cc:content-transfer-encoding:content-type:date:date:from:from :in-reply-to:in-reply-to:message-id:mime-version:references :reply-to:sender:subject:subject:to:to; s=fm2; t=1667313311; x= 1667399711; bh=24UpivM5Ypm/0UVUSmq5tYMVepMEGb3KFd+SZHmxexY=; b=R fkmQqn6mvDgL7EilfLKUD7b3S1sID3KuWqvGELEEdgsSEMi9qHk9qWxVUinZ2RMK QHdFKpiv1Nb/WXn4r+sGPioCwbIhKOVsM3o/1i7o+1+GuHvhHn+4G76nj6obAyg7 oU3W+GiKJOZpDPLnYAkLQCOBzCbzURBKMEcj7AyyW7+rV4NOZKwpRNrirSPud5LS 7s3ovuTnw75oAzHcZRjMd9TTO+V3lu/3kQyBNFlvMnn01/LP1arZzjMr1+Ii4E/o pxHMcCDRNIu3+crcR5j3U0o99GPh8rUqaDbGNLwy0rTBM38qMbdVt//5bTUwHa6F 3Mh5qegUXQC2k9gDgooeA== DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d= messagingengine.com; h=cc:content-transfer-encoding:content-type :date:date:feedback-id:feedback-id:from:from:in-reply-to :in-reply-to:message-id:mime-version:references:reply-to:sender :subject:subject:to:to:x-me-proxy:x-me-proxy:x-me-sender :x-me-sender:x-sasl-enc; s=fm3; t=1667313311; x=1667399711; bh=2 4UpivM5Ypm/0UVUSmq5tYMVepMEGb3KFd+SZHmxexY=; b=ILNajuqp3UnsOBg6D 7LrwwLHbMjJ8lhEMHGBCW7eEcSdF36VfWiAUiQNPuSS/u0sli6MmMl+0EsBM/89F 56/sqZedgu8z4T7PUhWWbeoAa9/ZLk8dCwyT3uyAJgZ+0TwQgn9kdQGaR4TP7n6x fhnvZhG8wWfjuYBXgzn5ViBVtCHcF/X3nWS0FMqwMHL3GtTL/tN0SecTM0i/+9lv knaL69gwiHEhPPHcjF8+rCkHrGtn7rOPL4eNil96T1ohX19c8b7XXBHK5bLNsEiI g8es3Jz0X8dDh7hx6vVTYxsMoK9chgN/LGJXzC9YvxcgZ19NwSbZ/wO7Ist2cEDv D8l+g== X-ME-Sender: X-ME-Received: X-ME-Proxy-Cause: gggruggvucftvghtrhhoucdtuddrgedvgedrudehgdeijecutefuodetggdotefrodftvf curfhrohhfihhlvgemucfhrghsthforghilhdpqfgfvfdpuffrtefokffrpgfnqfghnecu uegrihhlohhuthemuceftddtnecunecujfgurhepkfffgggfuffvfhfhjggtgfesthekre dttdefjeenucfhrhhomheptegurhhirghnucfmlhgrvhgvrhcuoegrughrihgrnhdrkhhl rghvvghrsegrkhhlrghvvghrrdgtohhmqeenucggtffrrghtthgvrhhnpeelkeegjefhke etheefudevteehiedvudehkeduleetfedvffeuhedtvdegtdeffeenucffohhmrghinhep phhoshhtghhrvghsqhhlrdhorhhgnecuvehluhhsthgvrhfuihiivgeptdenucfrrghrrg hmpehmrghilhhfrhhomheprggurhhirghnrdhklhgrvhgvrhesrghklhgrvhgvrhdrtgho mh X-ME-Proxy: Feedback-ID: i76984098:Fastmail Received: by mail.messagingengine.com (Postfix) with ESMTPA; Tue, 1 Nov 2022 10:35:11 -0400 (EDT) Message-ID: Date: Tue, 1 Nov 2022 07:35:10 -0700 MIME-Version: 1.0 User-Agent: Mozilla/5.0 (X11; Linux x86_64; rv:102.0) Gecko/20100101 Thunderbird/102.4.1 Subject: Re: Delete a table automatic? To: =?UTF-8?B?6buE5a6B?= , pgsql-general@postgresql.org References: Content-Language: en-US From: Adrian Klaver In-Reply-To: Content-Type: text/plain; charset=UTF-8; format=flowed Content-Transfer-Encoding: 8bit List-Id: List-Help: List-Subscribe: List-Post: List-Owner: List-Archive: Archived-At: Precedence: bulk On 10/31/22 18:44, 黄宁 wrote: > I now have two tables named A and B. Table B is calculated based on the > data of table A. I wonder if table B can be automatically deleted when > table A is deleted? The only thing I can think of is a sql_drop event trigger: https://www.postgresql.org/docs/current/functions-event-triggers.html#PG-EVENT-TRIGGER-SQL-DROP-FUNCTIONS 9.29.2. Processing Objects Dropped by a DDL Command Though this will not be specific to one table. -- Adrian Klaver adrian.klaver@aklaver.com