From: | Tom Lane <tgl(at)sss(dot)pgh(dot)pa(dot)us> |
---|---|
To: | sebastien(dot)flaesch(at)4js(dot)com |
Cc: | pgsql-docs(at)lists(dot)postgresql(dot)org |
Subject: | Re: Missing information about CREATE TRIGGER on temporary tables |
Date: | 2022-03-08 16:39:09 |
Message-ID: | 370487.1646757549@sss.pgh.pa.us |
Views: | Raw Message | Whole Thread | Download mbox | Resend email |
Thread: | |
Lists: | pgsql-docs |
PG Doc comments form <noreply(at)postgresql(dot)org> writes:
> The reference page about CREATE TRIGGER should indicate if it's allowed to
> create triggers on temp tables.
> This seems to be the supported, but I was wondering what happens with the
> trigger name when created on a temp table.
The page already says
The name to give the new trigger. This must be distinct from the name
of any other trigger for the same table.
That seems to be sufficient. There's no reason to mention temp tables
explicitly, because the rule isn't any different for them.
If you want to confirm that the documentation knows what it's talking
about, you could have a look at the system catalogs. The table that
stores triggers is pg_trigger, and "\d pg_trigger" in psql shows
=# \d pg_trigger
Table "pg_catalog.pg_trigger"
Column | Type | Collation | Nullable | Default
----------------+--------------+-----------+----------+---------
oid | oid | | not null |
tgrelid | oid | | not null |
tgparentid | oid | | not null |
tgname | name | | not null |
...
Indexes:
"pg_trigger_oid_index" PRIMARY KEY, btree (oid)
"pg_trigger_tgconstraint_index" btree (tgconstraint)
"pg_trigger_tgrelid_tgname_index" UNIQUE CONSTRAINT, btree (tgrelid, tgname)
So the uniqueness constraint is on table's OID + trigger's name.
Schemas don't enter into it.
regards, tom lane
From | Date | Subject | |
---|---|---|---|
Next Message | David G. Johnston | 2022-03-09 00:14:11 | Update wording of INSERT ON CONFLICT "rows proposed for insertion" |
Previous Message | David G. Johnston | 2022-03-08 16:38:39 | Re: Missing information about CREATE TRIGGER on temporary tables |