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 1q2AxD-0008Do-CF for pgsql-general@arkaria.postgresql.org; Thu, 25 May 2023 13:24:31 +0000 Received: from localhost ([127.0.0.1] helo=malur.postgresql.org) by malur.postgresql.org with esmtp (Exim 4.92) (envelope-from ) id 1q2AxC-00057A-8E for pgsql-general@arkaria.postgresql.org; Thu, 25 May 2023 13:24:30 +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 1q2AxB-00053x-Tt for pgsql-general@lists.postgresql.org; Thu, 25 May 2023 13:24:29 +0000 Received: from mout-u-204.mailbox.org ([2001:67c:2050:101:465::204]) by magus.postgresql.org with esmtps (TLS1.3) tls TLS_ECDHE_RSA_WITH_AES_256_GCM_SHA384 (Exim 4.94.2) (envelope-from ) id 1q2Ax8-0024pI-TO for pgsql-general@lists.postgresql.org; Thu, 25 May 2023 13:24:29 +0000 Received: from smtp1.mailbox.org (smtp1.mailbox.org [IPv6:2001:67c:2050:b231:465::1]) (using TLSv1.3 with cipher TLS_AES_256_GCM_SHA384 (256/256 bits) key-exchange ECDHE (P-384) server-signature RSA-PSS (4096 bits) server-digest SHA256) (No client certificate requested) by mout-u-204.mailbox.org (Postfix) with ESMTPS id 4QRpg60Bnxz9sQm; Thu, 25 May 2023 15:24:18 +0200 (CEST) Date: Thu, 25 May 2023 15:24:17 +0200 (CEST) From: Erik Wienhold To: Jim Vanns , pgsql-general@lists.postgresql.org Message-ID: <545191042.228527.1685021057520@office.mailbox.org> In-Reply-To: References: Subject: Re: CREATE TEMPORARY TABLE LIKE MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 7bit X-Priority: 3 Importance: Normal X-Rspamd-Queue-Id: 4QRpg60Bnxz9sQm List-Id: List-Help: List-Subscribe: List-Post: List-Owner: List-Archive: Archived-At: Precedence: bulk > On 25/05/2023 15:06 CEST Jim Vanns wrote: > > When basing a temporary table of a source table, are triggers included > by default? I have this statement; > > CREATE TEMPORARY TABLE dev_main ( > LIKE prod_main > INCLUDING ALL > EXCLUDING INDEXES > EXCLUDING CONSTRAINTS > ) ON COMMIT DELETE ROWS; > > And wondering if there is a trigger (row-based after) on prod_main > it'll fire also on dev_main? I can't find anything in the > documentation that suggests either way nor can I see an explicit > EXCLUDING option to be sure triggers aren't copied. You can check if triggers exist with psql: \d dev_main or by checking catalog pg_trigger: select * from pg_trigger where tgrelid = 'dev_main'::regclass; But no. Triggers are not included when creating tables like that. -- Erik