Received: from malur.postgresql.org ([217.196.149.56]) by arkaria.postgresql.org with esmtps (TLS1.2:ECDHE_RSA_AES_256_CBC_SHA1:256) (Exim 4.89) (envelope-from ) id 1iBJy3-0003Uz-Na for pgsql-bugs@arkaria.postgresql.org; Fri, 20 Sep 2019 14:33:03 +0000 Received: from localhost ([127.0.0.1] helo=malur.postgresql.org) by malur.postgresql.org with esmtp (Exim 4.89) (envelope-from ) id 1iBJy2-0005Xw-7N for pgsql-bugs@arkaria.postgresql.org; Fri, 20 Sep 2019 14:33:02 +0000 Received: from magus.postgresql.org ([2a02:c0:301:0:ffff::29]) by malur.postgresql.org with esmtps (TLS1.2:ECDHE_RSA_AES_256_CBC_SHA1:256) (Exim 4.89) (envelope-from ) id 1iBJy1-0005Xp-Vm for pgsql-bugs@lists.postgresql.org; Fri, 20 Sep 2019 14:33:02 +0000 Received: from sss.pgh.pa.us ([66.207.139.130]) by magus.postgresql.org with esmtps (TLS1.2:ECDHE_RSA_AES_256_CBC_SHA1:256) (Exim 4.89) (envelope-from ) id 1iBJxt-0006Vd-RR for pgsql-bugs@lists.postgresql.org; Fri, 20 Sep 2019 14:33:01 +0000 Received: from sss1.sss.pgh.pa.us (localhost [127.0.0.1]) by sss.pgh.pa.us (8.14.4/8.14.4) with ESMTP id x8KEWbtF016935; Fri, 20 Sep 2019 10:32:37 -0400 From: Tom Lane To: Ashutosh Sharma cc: PostgreSQL mailing lists , zhq651@126.com Subject: Re: BUG #16015: information_schema.triggers lack of truncate trigger In-reply-to: References: <16015-9cbd6cdd035d96f4@postgresql.org> Comments: In-reply-to Ashutosh Sharma message dated "Fri, 20 Sep 2019 16:42:47 +0530" MIME-Version: 1.0 Content-Type: text/plain; charset="us-ascii" Content-ID: <16933.1568989957.1@sss.pgh.pa.us> Date: Fri, 20 Sep 2019 10:32:37 -0400 Message-ID: <16934.1568989957@sss.pgh.pa.us> List-Id: List-Help: List-Subscribe: List-Post: List-Owner: List-Archive: Precedence: bulk Ashutosh Sharma writes: > This is what I found in the definition of triggers views in > information_schema.sql which says we are intentionally omitting > truncate triggers but then there is no clear cut explanation given for > this omission. The reason is that TRUNCATE triggers aren't in the SQL standard, so they can't be shown by a spec-compliant view. Concretely, SQL:2011 part 11 section 6.62 ("TRIGGERS base table") shows that column as having this definition: EVENT_MANIPULATION INFORMATION_SCHEMA.CHARACTER_DATA CONSTRAINT TRIGGERS_EVENT_MANIPULATION_CHECK CHECK ( EVENT_MANIPULATION IN ( 'INSERT', 'DELETE', 'UPDATE' ) ), Some other DBMSes think it's okay to bend the definition of the information_schema views so that they can show non-spec-compliant objects, but we don't. The point of those views, according to our policy, is to be useful to portable (spec-compliant) applications which presumably will only be creating spec-compliant objects. If somebody makes non-spec-compliant objects in the same database, and we show them in the information_schema, such an application could get mightily confused by what it sees there. In short, if you want to make Postgres-specific objects like ON TRUNCATE triggers, use Postgres-specific system catalog queries to introspect them. regards, tom lane