From: Erik Wienhold <ewie@ewie.name>
To: Jim Vanns <jvanns@ilm.com>
To: pgsql-general@lists.postgresql.org
Subject: Re: CREATE TEMPORARY TABLE LIKE
Date: Thu, 25 May 2023 15:24:17 +0200 (CEST)
Message-ID: <545191042.228527.1685021057520@office.mailbox.org> (raw)
In-Reply-To: <CAH7vdhOrC4CN=P+hCD=bEpm68ZEAJOB6ZitQbJ22MqDABecRnA@mail.gmail.com>
References: <CAH7vdhOrC4CN=P+hCD=bEpm68ZEAJOB6ZitQbJ22MqDABecRnA@mail.gmail.com>
> On 25/05/2023 15:06 CEST Jim Vanns <jvanns@ilm.com> 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
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 from your mail client; the link fills in
the headers below: reply via email
Some clients, webmail especially, drop In-Reply-To and References from
a link, and the reply then starts a new thread: use the mbox below.
To: pgsql-general@postgresql.org
Cc: ewie@ewie.name, jvanns@ilm.com
Subject: Re: CREATE TEMPORARY TABLE LIKE
In-Reply-To: <545191042.228527.1685021057520@office.mailbox.org>
References: <CAH7vdhOrC4CN=P+hCD=bEpm68ZEAJOB6ZitQbJ22MqDABecRnA@mail.gmail.com> <545191042.228527.1685021057520@office.mailbox.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