Postgres: See the instruction called by FK?
I am using Postgres 9.6 on Ubuntu.
With many tables and many foreign keys, when I delete certain data, it generates the appropriate commands implicitly to clear the foreign relations.
This can be seen when a long statement is DELETE
interrupted, for example. CTRL-c
it shows which background statement was fired.
Is there a way to see all the statements that are being generated / executed in the background? The config log_statement
doesn't display them either.
source to share
There is no built-in way, but possible with ExecutorStart_hook
.
auto_explain
contrib contrib can keep track of "nested" claims. Cm auto_explain.log_nested_statements
. I'm not sure if he ignores FK checks or considers them; the nested operator function is mainly used for things like PL / PgSQL.
source to share