Add ids to catalog/view columns in documentation

Started by Tristan Partin10 days ago4 messageshackers

Thread notes

1 note#docs
hackorum-bot#docs
hackorum-bot
2 days ago

@global #docs

#docs
Jump to latest
#1Tristan Partin
tristan@neon.tech

When referring to columns within catalog/views, I found it annoying that
they were not linkable. You could only link to something higher level
and then the reader was left to scroll and search for the column
definition.

I think adding IDs to column definitions would be a good idea. In this
initial patch, I've only decided to change pg_stat_statements
documentation. It should make it easier to view necessary changes and
visualize the impact of this change within the documentation.

Things that have changed:

- Octothorope is now visible when hovering a column within the column
definitions of pg_stat_statements and pg_stat_statements_info views
- Copying that link and pasting it in a new tab will take you directly
to the row of the column definition with a background color change to
highlight what was linked to. I understand that the CSS we use in-tree
is not the same CSS that is used on postgresql.org. I could make
a similar CSS change there as well if this seems like a good
direction.

I think there is discussion to be had about ID names. For instance,
I used the format <view>-view.<column>. Should we do that for all views?
How should IDs for catalog columns look? For pg_stat_statements
specifically, should I have used an ID like
pgstatstatements-<view>.<column>? Maybe there isn't a one size fits all
solution.

I'm happy to extend this to the rest of the documented catalogs/views if
this seems like a good idea to others. Question for a committer: would
you like the patch series for everything to look a certain way?

In the future, we could extend this concept to functions and operators
like in https://www.postgresql.org/docs/current/functions-json.html for
example.

--
Tristan Partin
PostgreSQL Contributors Team
AWS (https://aws.amazon.com)

#2Matthias van de Meent
boekewurm+postgres@gmail.com
In reply to: Tristan Partin (#1)
Re: Add ids to catalog/view columns in documentation

On Wed, 18 Nov 2026 at 19:34, Tristan Partin <tristan@partin.io> wrote:

When referring to columns within catalog/views, I found it annoying that
they were not linkable. You could only link to something higher level
and then the reader was left to scroll and search for the column
definition.

I think adding IDs to column definitions would be a good idea. In this
initial patch, I've only decided to change pg_stat_statements
documentation. It should make it easier to view necessary changes and
visualize the impact of this change within the documentation.

I like minimal changes, but you're stretching it a bit. I think I
like the idea behind the patch, though.

Things that have changed:

- Octothorope

TIL. Alternatively: "#", pound, or sharp.

is now visible when hovering a column within the column
definitions of pg_stat_statements and pg_stat_statements_info views

What is it that you hover? The document's column, the document's row
that describes the view column, or the table cell that has the name of
the view column? I assume the last of these?

- Copying that link and pasting it in a new tab will take you directly
to the row of the column definition with a background color change to
highlight what was linked to. I understand that the CSS we use in-tree
is not the same CSS that is used on postgresql.org. I could make
a similar CSS change there as well if this seems like a good
direction.

I think there is discussion to be had about ID names. For instance,
I used the format <view>-view.<column>. Should we do that for all views?

I think I'd like "catalog [sep] <schema>.<objname>[.<column>]` better,
as it's simpler to remember, copy-paste, and read. [sep] could be any
useful symbol; "." would be a natural fit but : or - could work, too.

How should IDs for catalog columns look? For pg_stat_statements
specifically, should I have used an ID like
pgstatstatements-<view>.<column>? Maybe there isn't a one size fits all
solution.

With the above solution, you could select the extension's name as schema prefix.

Kind regards,

Matthias van de Meent
Databricks (https://www.databricks.com)

#3Tristan Partin
tristan@neon.tech
In reply to: Matthias van de Meent (#2)
Re: Add ids to catalog/view columns in documentation

On Wed Nov 18, 2026 at 6:55 PM UTC, Matthias van de Meent wrote:

On Wed, 18 Nov 2026 at 19:34, Tristan Partin <tristan@partin.io> wrote:

When referring to columns within catalog/views, I found it annoying that
they were not linkable. You could only link to something higher level
and then the reader was left to scroll and search for the column
definition.

I think adding IDs to column definitions would be a good idea. In this
initial patch, I've only decided to change pg_stat_statements
documentation. It should make it easier to view necessary changes and
visualize the impact of this change within the documentation.

I like minimal changes, but you're stretching it a bit. I think I
like the idea behind the patch, though.

Things that have changed:

- Octothorope

TIL. Alternatively: "#", pound, or sharp.

I actually misspelled it! Octothorpe.

is now visible when hovering a column within the column
definitions of pg_stat_statements and pg_stat_statements_info views

What is it that you hover? The document's column, the document's row
that describes the view column, or the table cell that has the name of
the view column? I assume the last of these?

If you are looking at the pg_stat_statements columns, hover the area
containing the column name and type. That amounts to a:

<p class="column_definition">...</p>

- Copying that link and pasting it in a new tab will take you directly
to the row of the column definition with a background color change to
highlight what was linked to. I understand that the CSS we use in-tree
is not the same CSS that is used on postgresql.org. I could make
a similar CSS change there as well if this seems like a good
direction.

I think there is discussion to be had about ID names. For instance,
I used the format <view>-view.<column>. Should we do that for all views?

I think I'd like "catalog [sep] <schema>.<objname>[.<column>]` better,
as it's simpler to remember, copy-paste, and read. [sep] could be any
useful symbol; "." would be a natural fit but : or - could work, too.

Part of the problem is that we don't necessarily seem to be very
consistent with IDs already.

Here is the ID of the pg_stat_statements view documentation:
PGSTATSTATEMENTS-PG-STAT-STATEMENTS. And then here is the ID of
pg_stat_activity: MONITORING-PG-STAT-ACTIVITY-VIEW.

So we seem to use a prefix (pgstatstatements vs monitoring)
consistently, but whether we append the word view is not. I wonder if we
should rectify that to make things more consistent and predictable as
you said.

How should IDs for catalog columns look? For pg_stat_statements
specifically, should I have used an ID like
pgstatstatements-<view>.<column>? Maybe there isn't a one size fits all
solution.

With the above solution, you could select the extension's name as schema prefix.

--
Tristan Partin
PostgreSQL Contributors Team
AWS (https://aws.amazon.com)

#4Tristan Partin
tristan@neon.tech
In reply to: Tristan Partin (#3)
Re: Add ids to catalog/view columns in documentation

Matthias informed me off list that I have forgotten to include the
patches. Silly :).

Here are the attached patches.

--
Tristan Partin
PostgreSQL Contributors Team
AWS (https://aws.amazon.com)

Attachments:

t259390_4
v1-0001-Add-ids-to-catalog-view-columns-in-documentation.patchtext/x-patch; charset=utf-8; name=v1-0001-Add-ids-to-catalog-view-columns-in-documentation.patchDownload+142-74