From: Tom Lane <tgl@sss.pgh.pa.us>
To: Ashutosh Sharma <ashu.coek88@gmail.com>
Cc: PostgreSQL mailing lists <pgsql-bugs@lists.postgresql.org>
Cc: zhq651@126.com
Subject: Re: BUG #16015: information_schema.triggers lack of truncate trigger
Date: Fri, 20 Sep 2019 10:32:37 -0400
Message-ID: <16934.1568989957@sss.pgh.pa.us> (raw)
In-Reply-To: <CAE9k0Pnd_M-8-gk=67M35mT7PQBWA2Qase76T5pQiRrLob1v6w@mail.gmail.com>
References: <16015-9cbd6cdd035d96f4@postgresql.org>
<CAE9k0Pnd_M-8-gk=67M35mT7PQBWA2Qase76T5pQiRrLob1v6w@mail.gmail.com>
Ashutosh Sharma <ashu.coek88@gmail.com> 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
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-bugs@postgresql.org
Cc: tgl@sss.pgh.pa.us, ashu.coek88@gmail.com, zhq651@126.com
Subject: Re: BUG #16015: information_schema.triggers lack of truncate trigger
In-Reply-To: <16934.1568989957@sss.pgh.pa.us>
References: <16015-9cbd6cdd035d96f4@postgresql.org> <CAE9k0Pnd_M-8-gk=67M35mT7PQBWA2Qase76T5pQiRrLob1v6w@mail.gmail.com> <16934.1568989957@sss.pgh.pa.us>
* 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