pg.ddx.io pgsql-general@postgresql.org mailing list archive
help / color / mirror / Atom feedCREATE TEMPORARY TABLE LIKE
3+ messages / 2 participants
[nested] [flat]
* CREATE TEMPORARY TABLE LIKE
@ 2023-05-25 13:06 Jim Vanns <jvanns@ilm.com>
0 siblings, 2 replies; 3+ messages in thread
From: Jim Vanns @ 2023-05-25 13:06 UTC (permalink / raw)
To: pgsql-general@lists.postgresql.org
Hi everyone,
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.
Does anyone know?
Cheers,
Jim
--
Jim Vanns
Principal Production Engineer
Industrial Light & Magic, London
^ permalink raw reply [nested|flat] 3+ messages in thread
* Re: CREATE TEMPORARY TABLE LIKE
@ 2023-05-25 13:19 Jim Vanns <jvanns@ilm.com>
parent: Jim Vanns <jvanns@ilm.com>
1 sibling, 0 replies; 3+ messages in thread
From: Jim Vanns @ 2023-05-25 13:19 UTC (permalink / raw)
To: pgsql-general@lists.postgresql.org
I just wrote a little test case... it appears not. Triggers aren't
fired in the temporary table.
Jim
On Thu, 25 May 2023 at 14:06, Jim Vanns <jvanns@ilm.com> wrote:
>
> Hi everyone,
>
> 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.
>
> Does anyone know?
>
> Cheers,
>
> Jim
>
> --
> Jim Vanns
> Principal Production Engineer
> Industrial Light & Magic, London
--
Jim Vanns
Principal Production Engineer
Industrial Light & Magic, London
^ permalink raw reply [nested|flat] 3+ messages in thread
* Re: CREATE TEMPORARY TABLE LIKE
@ 2023-05-25 13:24 Erik Wienhold <ewie@ewie.name>
parent: Jim Vanns <jvanns@ilm.com>
1 sibling, 0 replies; 3+ messages in thread
From: Erik Wienhold @ 2023-05-25 13:24 UTC (permalink / raw)
To: Jim Vanns <jvanns@ilm.com>; pgsql-general@lists.postgresql.org
> 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
^ permalink raw reply [nested|flat] 3+ messages in thread
end of thread, other threads:[~2023-05-25 13:24 UTC | newest]
Thread overview: 3+ messages (download: mbox mbox.gz follow: Atom feed)
-- links below jump to the message on this page --
2023-05-25 13:06 CREATE TEMPORARY TABLE LIKE Jim Vanns <jvanns@ilm.com>
2023-05-25 13:19 ` Jim Vanns <jvanns@ilm.com>
2023-05-25 13:24 ` Erik Wienhold <ewie@ewie.name>
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