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 1nRcrl-0004y6-4i for pgsql-docs@arkaria.postgresql.org; Tue, 08 Mar 2022 16:39:17 +0000 Received: from localhost ([127.0.0.1] helo=malur.postgresql.org) by malur.postgresql.org with esmtp (Exim 4.92) (envelope-from ) id 1nRcrj-0000di-Ah for pgsql-docs@arkaria.postgresql.org; Tue, 08 Mar 2022 16:39:15 +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 1nRcrj-0000dZ-3S for pgsql-docs@lists.postgresql.org; Tue, 08 Mar 2022 16:39:15 +0000 Received: from sss.pgh.pa.us ([66.207.139.130]) by magus.postgresql.org with esmtps (TLS1.3:ECDHE_RSA_AES_256_GCM_SHA384:256) (Exim 4.92) (envelope-from ) id 1nRcrg-0000DB-V2 for pgsql-docs@lists.postgresql.org; Tue, 08 Mar 2022 16:39:14 +0000 Received: from sss1.sss.pgh.pa.us (localhost [127.0.0.1]) by sss.pgh.pa.us (8.15.2/8.15.2) with ESMTP id 228Gd9Dd370488; Tue, 8 Mar 2022 11:39:09 -0500 From: Tom Lane To: sebastien.flaesch@4js.com cc: pgsql-docs@lists.postgresql.org Subject: Re: Missing information about CREATE TRIGGER on temporary tables In-reply-to: <164675354342.1369298.14513879086676370656@wrigleys.postgresql.org> References: <164675354342.1369298.14513879086676370656@wrigleys.postgresql.org> Comments: In-reply-to PG Doc comments form message dated "Tue, 08 Mar 2022 15:32:23 +0000" MIME-Version: 1.0 Content-Type: text/plain; charset="us-ascii" Content-ID: <370486.1646757549.1@sss.pgh.pa.us> Content-Transfer-Encoding: quoted-printable Date: Tue, 08 Mar 2022 11:39:09 -0500 Message-ID: <370487.1646757549@sss.pgh.pa.us> List-Id: List-Help: List-Subscribe: List-Post: List-Owner: List-Archive: Archived-At: Precedence: bulk PG Doc comments form 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 th= e > 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 =3D# \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, t= gname) So the uniqueness constraint is on table's OID + trigger's name. Schemas don't enter into it. regards, tom lane