Include the dependent extension information in describe command.

Started by vignesh Cabout 4 years ago6 messageshackers
Beta feature

Hackorum builds and tests every patch posted to the lists, not only commitfest submissions. This is Hackorum's own CI rather than the PostgreSQL project's, and it is still under testing - please report anything that looks wrong.

won't retrysuccessCI history

You can run a PostgreSQL built from this patch straight from Docker, with no checkout and no build:

docker run --rm -p 5432:5432 ghcr.io/hackorum-dev/postgres-patch:t46406
psql -h localhost -U postgres

Built from patchset v4 (message #4), July 28, 2026 at 02:14 AM.

Every patchset is also pushed to a branch of our PostgreSQL fork, so you can check out the same tree CI built. Without a PostgreSQL checkout:

git clone --branch t46406_4 https://github.com/hackorum-dev/postgres.git

In a checkout you already have, add the fork once:

git remote add hackorum https://github.com/hackorum-dev/postgres.git

then, for this patchset and every later one:

git fetch hackorum t46406_4 && git checkout t46406_4

Patchset v4 (message #4) is on t46406_4

Jump to latest
#1vignesh C
vignesh21@gmail.com

Hi,

Currently we do not include the dependent extension information for
index and materialized view in the describe command. I felt it would
be useful to include this information as part of the describe command
like:
\d+ idx_depends
Index "public.idx_depends"
Column | Type | Key? | Definition | Storage | Stats target
--------+---------+------+------------+---------+--------------
a | integer | yes | a | plain |
btree, for table "public.tbl_idx_depends"
Depends:
"plpgsql"

Attached a patch for the same. Thoughts?

Regards,
Vignesh

Attachments:

v1-0001-Include-the-dependent-extension-information-for-i.patchapplication/octet-stream; name=v1-0001-Include-the-dependent-extension-information-for-i.patchDownload+96-1
#2Tom Lane
tgl@sss.pgh.pa.us
In reply to: vignesh C (#1)
Re: Include the dependent extension information in describe command.

vignesh C <vignesh21@gmail.com> writes:

Currently we do not include the dependent extension information for
index and materialized view in the describe command. I felt it would
be useful to include this information as part of the describe command
like:
\d+ idx_depends
Index "public.idx_depends"
Column | Type | Key? | Definition | Storage | Stats target
--------+---------+------+------------+---------+--------------
a | integer | yes | a | plain |
btree, for table "public.tbl_idx_depends"
Depends:
"plpgsql"

Attached a patch for the same. Thoughts?

This seems pretty much useless noise to me. Can you point to
any previous requests for such a feature? If we did do it,
why would we do it in such a narrow fashion (ie, only dependencies
of two specific kinds of objects on one other specific kind of
object)? Why did you do it in this direction rather than
the other one, ie show dependencies when examining the extension?

regards, tom lane

#3vignesh C
vignesh21@gmail.com
In reply to: Tom Lane (#2)
Re: Include the dependent extension information in describe command.

On Sun, Aug 14, 2022 at 11:07 AM Tom Lane <tgl@sss.pgh.pa.us> wrote:

vignesh C <vignesh21@gmail.com> writes:

Currently we do not include the dependent extension information for
index and materialized view in the describe command. I felt it would
be useful to include this information as part of the describe command
like:
\d+ idx_depends
Index "public.idx_depends"
Column | Type | Key? | Definition | Storage | Stats target
--------+---------+------+------------+---------+--------------
a | integer | yes | a | plain |
btree, for table "public.tbl_idx_depends"
Depends:
"plpgsql"

Attached a patch for the same. Thoughts?

This seems pretty much useless noise to me. Can you point to
any previous requests for such a feature? If we did do it,
why would we do it in such a narrow fashion (ie, only dependencies
of two specific kinds of objects on one other specific kind of
object)? Why did you do it in this direction rather than
the other one, ie show dependencies when examining the extension?

While implementing logical replication of "index which depends on
extension", I found that this information was not available in any of
the \d describe commands. I felt having this information in the \d
describe command will be useful in validating the "depends on
extension" easily. Now that you pointed out, I agree that it will be
better to show the dependencies from the extension instead of handling
it in multiple places. I will change it to handle it from extension
and post an updated version soon for this.

Regards,
Vignesh

#4vignesh C
vignesh21@gmail.com
In reply to: vignesh C (#3)
Re: Include the dependent extension information in describe command.

On Sun, Aug 14, 2022 at 10:24 PM vignesh C <vignesh21@gmail.com> wrote:

On Sun, Aug 14, 2022 at 11:07 AM Tom Lane <tgl@sss.pgh.pa.us> wrote:

vignesh C <vignesh21@gmail.com> writes:

Currently we do not include the dependent extension information for
index and materialized view in the describe command. I felt it would
be useful to include this information as part of the describe command
like:
\d+ idx_depends
Index "public.idx_depends"
Column | Type | Key? | Definition | Storage | Stats target
--------+---------+------+------------+---------+--------------
a | integer | yes | a | plain |
btree, for table "public.tbl_idx_depends"
Depends:
"plpgsql"

Attached a patch for the same. Thoughts?

This seems pretty much useless noise to me. Can you point to
any previous requests for such a feature? If we did do it,
why would we do it in such a narrow fashion (ie, only dependencies
of two specific kinds of objects on one other specific kind of
object)? Why did you do it in this direction rather than
the other one, ie show dependencies when examining the extension?

While implementing logical replication of "index which depends on
extension", I found that this information was not available in any of
the \d describe commands. I felt having this information in the \d
describe command will be useful in validating the "depends on
extension" easily. Now that you pointed out, I agree that it will be
better to show the dependencies from the extension instead of handling
it in multiple places. I will change it to handle it from extension
and post an updated version soon for this.

I have updated the patch to display "Objects depending on extension"
as describe extension footer. The changes for the same are available
in the v2 version patch attached. Thoughts?

Regards,
Vignesh

Attachments:

t46406_4
v2-0001-Include-the-objects-depending-on-extension-in-des.patchtext/x-patch; charset=US-ASCII; name=v2-0001-Include-the-objects-depending-on-extension-in-des.patchDownload+128-22
#5Bruce Momjian
bruce@momjian.us
In reply to: vignesh C (#4)
Re: Include the dependent extension information in describe command.

On Mon, Aug 15, 2022 at 10:09:29PM +0530, vignesh C wrote:

I have updated the patch to display "Objects depending on extension"
as describe extension footer. The changes for the same are available
in the v2 version patch attached. Thoughts?

I wonder if we would be better off with a backslash command that showed
the dependencies of any object.

--
Bruce Momjian <bruce@momjian.us> https://momjian.us
EDB https://enterprisedb.com

Indecision is a decision. Inaction is an action. Mark Batterson

#6vignesh C
vignesh21@gmail.com
In reply to: Bruce Momjian (#5)
Re: Include the dependent extension information in describe command.

On Tue, Aug 16, 2022 at 9:04 PM Bruce Momjian <bruce@momjian.us> wrote:

On Mon, Aug 15, 2022 at 10:09:29PM +0530, vignesh C wrote:

I have updated the patch to display "Objects depending on extension"
as describe extension footer. The changes for the same are available
in the v2 version patch attached. Thoughts?

I wonder if we would be better off with a backslash command that showed
the dependencies of any object.

Yes, If we have a backslash command which could show the dependencies
of the specified object could be helpful.
Can we something like below:
a) Index idx1 depend on table t1
create table t1(c1 int);
create index idx1 on t1(c1);
postgres=# \dD idx1
Name
---------
idx1
Depends on:
table t1

b) Index idx1 depend on table t1 and extension ext1
alter index idx idx1 depends on extension ext1
postgres=# \dD idx1
Name
---------
idx1
Depends on:
table t1
extension ext1

c) materialized view mv1 depends on table t1
create materialized view mv1 as select * from t1;
postgres=# \dD mv1
Name
---------
mv1
Depends on:
table t1

If you are ok with this approach, I can implement a patch on similar
lines. Thoughts?

Regards,
Vignesh