Re: Idea Feedback: psql \h misses -> Offers Links?

From: "Euler Taveira" <euler(at)eulerto(dot)com>
To: "Kirk Wolak" <wolakk(at)gmail(dot)com>, "PostgreSQL Hackers" <pgsql-hackers(at)lists(dot)postgresql(dot)org>
Cc: "Andrey Borodin" <x4mmm(at)yandex-team(dot)ru>, "Nikolay Samokhvalov" <samokhvalov(at)gmail(dot)com>
Subject: Re: Idea Feedback: psql \h misses -> Offers Links?
Date: 2024-04-19 14:12:54
Message-ID: e3deb4ca-0835-4e35-9abc-753e7b6dfc0c@app.fastmail.com
Views: Raw Message | Whole Thread | Download mbox | Resend email
Thread:
Lists: pgsql-hackers

On Wed, Apr 17, 2024, at 2:47 PM, Kirk Wolak wrote:
> I often use the ctrl-click on the link after getting help in psql. A great feature.
>
> Challenge, when there is no help, you don't get any link.
>
> My thought process is to add a default response that would take them to
> https://www.postgresql.org/search/?u=%2Fdocs%2F16%2F&q={TOKEN} <https://www.postgresql.org/search/?u=%2Fdocs%2F16%2F&q=%7BTOKEN%7D>
>
> *Example:*
> \h current_setting
> No help available for "current_setting".
> Try \h with no arguments to see available help.

That's because current_setting is a function. Help says:

postgres=# \?
.
.
.
Help
\? [commands] show help on backslash commands
\? options show help on psql command-line options
\? variables show help on special variables
\h [NAME] help on syntax of SQL commands, * for all commands

It is just for SQL commands.

> https://www.postgresql.org/search/?u=%2Fdocs%2F16%2F&q=current_setting
>
> To me, this is a huge step in helping me get to the docs.
>
> This is Question 1: Do others see the potential value here?

Yes. However, I expect an exact and direct answer. There will be cases that the
first result is not the one you are looking for. (You are expecting the
function or parameter description but other page is on the top because it is
more relevant.) The referred URL does not point you to the direct link.
Instead, you have to click again to be able to check the content.

> Question 2: What if we allowed the users to set some extra link Templates using \pset??
>
> \pset help_assist_link_1 = https://www.google.com/search?q={token} <https://www.google.com/search?q=%7Btoken%7D>'
> \pset help_assist_link_2 = 'https://wiki.postgresql.org/index.php?title=Special%3ASearch&search={token}&go=Go <https://wiki.postgresql.org/index.php?title=Special%3ASearch&search=%7Btoken%7D&go=Go>'

That's a different idea. Are you proposing to provide URLs if this psql
variable is set and it doesn't find an entry (say \h foo)? I'm not sure if it
is a good idea to allow third-party URLs (even if it is configurable).

IMO we should expand \h to list documentation references for functions and GUCs
using SGML files. We already did it for SQL commands. Another broader idea is
to build an inverted index similar to what Index [1] provides. The main problem
with this approach is to create a dependency between documentation build and
psql. Maybe there is a reasonable way to obtain the links for each term.

[1] https://www.postgresql.org/docs/current/bookindex.html

--
Euler Taveira
EDB https://www.enterprisedb.com/

In response to

Responses

Browse pgsql-hackers by date

  From Date Subject
Next Message Tomas Vondra 2024-04-19 14:14:00 Re: brininsert optimization opportunity
Previous Message Tom Lane 2024-04-19 14:10:21 Re: Possible to exclude a database from loading a shared_preload_libraries module?