Re: Adding comments to extension objects

From: Andrew Dunstan <andrew(at)dunslane(dot)net>
To: Bruce Momjian <bruce(at)momjian(dot)us>, PostgreSQL-development <pgsql-hackers(at)lists(dot)postgresql(dot)org>
Subject: Re: Adding comments to extension objects
Date: 2026-08-08 22:12:40
Message-ID: cbe7d62d-8fdc-423a-9eaa-4b4fa0e16935@dunslane.net
Views: Whole Thread | Raw Message | Download mbox | Resend email
Thread:
Lists: pgsql-hackers


On 2026-08-08 Sa 9:17 AM, Bruce Momjian wrote:
> I think SQL object comments are very useful for users, and even more
> useful now that many people are using MCP:
>
> https://momjian.us/main/blogs/pgblog/2026.html#March_16_2026
>
> Would someone please volunteer to check all externally-developed
> extensions to see if they have the appropriate object comments, and if
> not, either create a patch to add them or contact the author suggesting
> they add them. I have done this already for pgvector:
>
> https://momjian.us/main/blogs/pgblog/2026.html#March_16_2026

I think we need to be more specific about what might help here. I asked
Claude what sort of objects commenting on in this way would help. Here's
its answer:

*Always worth it: *|TABLE|, |FOREIGN TABLE|, partitioned tables,
|COLUMN|, |VIEW|, |MATERIALIZED VIEW| Why: Read by essentially every
server; named directly in every query

*Worth it if your server reads them*|: SCHEMA|, |FUNCTION|/|PROCEDURE|,
|TYPE|, |DOMAIN|, |SERVER| Why: Read by better servers, and the model
can name all of them

*Usually not worth it: *|INDEX|, |CONSTRAINT|, |TRIGGER|, |POLICY|,
|SEQUENCE|, |OPERATOR|, |RULE|, |ROLE|, |DATABASE|, |TABLESPACE| Why:
Rarely fetched, and mostly not nameable in generated SQL

So, if your extension creates a Foreign Data Wrapper, as several of mine
do, there's really nothing for you to do. By all means comment on it,
but it is very unlikely to help an MCP server. On the other hand, if it
creates functions and types, commenting on those is probably a good
idea, and if it creates tables it's a very good idea.

I also asked claude for a template. It gave me one with a worked
example. It's attached.

cheers

andrew

--
Andrew Dunstan
EDB:https://www.enterprisedb.com

Attachment Content-Type Size
mcp-comment-template text/plain 8.2 KB

In response to

Responses

Browse pgsql-hackers by date

  From Date Subject
Next Message Bruce Momjian 2026-08-08 23:48:33 Re: Adding comments to extension objects
Previous Message Tomas Vondra 2026-08-08 22:08:44 Re: Is there value in having optimizer stats for joins/foreignkeys?