Re: Dropping constraints on a table locks referenced table... why?

From: Tom Lane <tgl(at)sss(dot)pgh(dot)pa(dot)us>
To: Wells Oliver <wells(dot)oliver(at)gmail(dot)com>
Cc: pgsql-admin(at)postgresql(dot)org
Subject: Re: Dropping constraints on a table locks referenced table... why?
Date: 2018-04-18 18:39:25
Message-ID: 8704.1524076765@sss.pgh.pa.us
Views: Raw Message | Whole Thread | Download mbox | Resend email
Thread:
Lists: pgsql-admin

Wells Oliver <wells(dot)oliver(at)gmail(dot)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

In response to

Browse pgsql-admin by date

  From Date Subject
Next Message Don Seiler 2018-04-18 21:45:00 Problem with postgres_fdw and partitioned tables (9.6 to 10.2)
Previous Message Wells Oliver 2018-04-18 18:14:41 Re: Dropping constraints on a table locks referenced table... why?