From: Tom Lane <tgl@sss.pgh.pa.us>
To: Wells Oliver <wells.oliver@gmail.com>
Cc: pgsql-admin@postgresql.org
Subject: Re: Dropping constraints on a table locks referenced table... why?
Date: Wed, 18 Apr 2018 14:39:25 -0400
Message-ID: <8704.1524076765@sss.pgh.pa.us> (raw)
In-Reply-To: <CAOC+FBXgecnsA8vaUcODiMWK3gCr4UQBVbA6HAwgB6A5DK6+EQ@mail.gmail.com>
References: <CAOC+FBX7kKHXzfAyeMGn__vE8WoXYpDSR=SUaGtBfTmFoNQpAQ@mail.gmail.com>
<2444.1523991472@sss.pgh.pa.us>
<CAOC+FBXgecnsA8vaUcODiMWK3gCr4UQBVbA6HAwgB6A5DK6+EQ@mail.gmail.com>
Wells Oliver <wells.oliver@gmail.com> writes:
> Where can I see these triggers? They don't show under the PG Admin trigger
> tab of course, are they, I don't know, special triggers, stored elsewhere?
> Can I query an internal PG table?
Sure, like this:
regression=# create table pk (f1 int primary key);
CREATE TABLE
regression=# create table fk (f1 int references pk);
CREATE TABLE
regression=# select tgname,tgfoid::regproc from pg_trigger where tgrelid = 'pk'::regclass;
tgname | tgfoid
------------------------------+------------------------
RI_ConstraintTrigger_a_51649 | "RI_FKey_noaction_del"
RI_ConstraintTrigger_a_51650 | "RI_FKey_noaction_upd"
(2 rows)
regression=# select tgname,tgfoid::regproc from pg_trigger where tgrelid = 'fk'::regclass;
tgname | tgfoid
------------------------------+---------------------
RI_ConstraintTrigger_c_51651 | "RI_FKey_check_ins"
RI_ConstraintTrigger_c_51652 | "RI_FKey_check_upd"
(2 rows)
psql and probably most other client tools hide these triggers figuring
they're uninteresting, but they're pretty ordinary triggers otherwise.
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 using the --to and --cc options:
reply via email
To: pgsql-admin@postgresql.org
Cc: tgl@sss.pgh.pa.us, wells.oliver@gmail.com
Subject: Re: Dropping constraints on a table locks referenced table... why?
In-Reply-To: <8704.1524076765@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