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

  • Jump to comment-1
    wolakk@gmail.com2024-04-17T17:47:36+00:00
    Hackers, 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. 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? 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}' \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> ' Such that the output, this time would be: *Example:* \h current_setting No help available for "current_setting". Try \h with no arguments to see available help. https://www.postgresql.org/search/?u=%2Fdocs%2F16%2F&q=current_setting https://www.google.com/search?q=current_setting https://wiki.postgresql.org/index.php?title=Special%3ASearch&search=current_setting&go=Go This Latter feature, I would consider applying to even successful searches? [Based on Feedback here] Thoughts?
    • Jump to comment-1
      peter@eisentraut.org2024-04-18T18:37:33+00:00
      On 17.04.24 19:47, Kirk Wolak wrote: > *Example:* > \h current_setting > No help available for "current_setting". > Try \h with no arguments to see available help. > > https://www.postgresql.org/search/?u=%2Fdocs%2F16%2F&q=current_setting > <https://www.postgresql.org/search/?u=%2Fdocs%2F16%2F&q=current_setting> One problem is that this search URL does not actually produce any useful information about current_setting.
      • Jump to comment-1
        wolakk@gmail.com2024-04-18T21:29:50+00:00
        On Thu, Apr 18, 2024 at 2:37 PM Peter Eisentraut <peter@eisentraut.org> wrote: > On 17.04.24 19:47, Kirk Wolak wrote: > > *Example:* > > \h current_setting > > No help available for "current_setting". > > Try \h with no arguments to see available help. > > > > https://www.postgresql.org/search/?u=%2Fdocs%2F16%2F&q=current_setting > > <https://www.postgresql.org/search/?u=%2Fdocs%2F16%2F&q=current_setting> > > One problem is that this search URL does not actually produce any useful > information about current_setting. > > I see what you mean, but doesn't that imply our web search feature is weak? That's the full name of an existing function, and it's in the index. But it cannot be found if searched from the website?
        • Jump to comment-1
          peter@eisentraut.org2024-04-19T08:45:53+00:00
          On 18.04.24 23:29, Kirk Wolak wrote: > On Thu, Apr 18, 2024 at 2:37 PM Peter Eisentraut <peter@eisentraut.org > <mailto:peter@eisentraut.org>> wrote: > > On 17.04.24 19:47, Kirk Wolak wrote: > > *Example:* > > \h current_setting > > No help available for "current_setting". > > Try \h with no arguments to see available help. > > > > > https://www.postgresql.org/search/?u=%2Fdocs%2F16%2F&q=current_setting <https://www.postgresql.org/search/?u=%2Fdocs%2F16%2F&q=current_setting> > > > <https://www.postgresql.org/search/?u=%2Fdocs%2F16%2F&q=current_setting <https://www.postgresql.org/search/?u=%2Fdocs%2F16%2F&q=current_setting>> > > One problem is that this search URL does not actually produce any > useful > information about current_setting. > > I see what you mean, but doesn't that imply our web search feature is > weak?  That's the full name of an existing function, and it's in the > index. But it cannot be found if searched from the website? Maybe it's weak, or maybe we are using it wrong, I don't know. \h has always been (a) local help, and (b) help specifically about SQL commands. If we are going to vastly expand the scope, we need to think it through more thoroughly. I could see some kind of \onlinehelp command, or maybe even redesigning \h altogether. Also, as you say, the function is in the documentation index, so there should be a deterministic way to go directly to exactly the target destination. Maybe the full-text search functionality of the web site is the wrong interface for that.
    • Jump to comment-1
      euler@eulerto.com2024-04-19T14:14:46+00:00
      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/