Dependency tree to tie type/function deps to a table

From: Jeremy Finzel <finzelj(at)gmail(dot)com>
To: pgsql-general(at)lists(dot)postgresql(dot)org
Subject: Dependency tree to tie type/function deps to a table
Date: 2017-12-13 15:07:16
Message-ID: CAMa1XUj6FBQ2USDa53TKquHAjRZwSrTwNDSnaTm=11wjdq4Nsg@mail.gmail.com
Views: Raw Message | Whole Thread | Download mbox | Resend email
Thread:
Lists: pgsql-general

It looks like the very useful dependency tree shown when using DROP CASCADE
is written in C in dependency.c, but there is no way to leverage this
within Postgres to actually query an object's dependencies. Can we get
this somehow as a Postgres client in SQL?

One of the problems we face over and over is that we want precisely this
list of dependencies, for example so that we can recreate a base table with
all of the dependencies on top of it.

The pg_depend_display <https://wiki.postgresql.org/wiki/Pg_depend_display> is
not perfect for example to tie together functions that have table
dependencies. Currently, if I have a function foo() that returns type
setof foo where foo is a foreign table, the pg_depend_display functions
shows no connection between the function foo() and the type foo to the
table foo.

Is there any way we can get that dependency.c code in a consumable form
inside postgres, for example as an ordered JSON list of objects as
dependencies to be recreated that could be passed to pg_dump in order to
recreate the objects in order after recreating a table?

Really appreciate any feedback.

Thanks!
Jeremy

Responses

Browse pgsql-general by date

  From Date Subject
Next Message Tomas Vondra 2017-12-13 15:08:28 Re: Size of pg_multixact/members increases 11355
Previous Message Yogesh Sharma 2017-12-13 12:42:36 Re: Size of pg_multixact/members increases 11355