Thread

Commits

  1. psql: Add documentation URL to \help output

  1. psql show URL with help

    Peter Eisentraut <peter.eisentraut@2ndquadrant.com> — 2019-02-21T17:28:09Z

    As mentioned on
    
    https://www.cybertec-postgresql.com/en/looking-at-mysql-8-with-postgresql-goggles-on/
    
    how about this:
    
    => \h analyze
    Command:     ANALYZE
    Description: collect statistics about a database
    Syntax:
    ANALYZE [ ( option [, ...] ) ] [ table_and_columns [, ...] ]
    ANALYZE [ VERBOSE ] [ table_and_columns [, ...] ]
    
    where option can be one of:
    
        VERBOSE
        SKIP_LOCKED
    
    and table_and_columns is:
    
        table_name [ ( column_name [, ...] ) ]
    
    URL: https://www.postgresql.org/docs/12/sql-analyze.html
    ^^^^
    
    (Won't actually work because the web site isn't serving "12" URLs yet,
    but that's something that could probably be sorted out.)
    
    -- 
    Peter Eisentraut              http://www.2ndQuadrant.com/
    PostgreSQL Development, 24x7 Support, Remote DBA, Training & Services
    
    
    
  2. Re: psql show URL with help

    Pavel Stehule <pavel.stehule@gmail.com> — 2019-02-21T17:32:51Z

    čt 21. 2. 2019 v 18:28 odesílatel Peter Eisentraut <
    peter.eisentraut@2ndquadrant.com> napsal:
    
    > As mentioned on
    >
    >
    > https://www.cybertec-postgresql.com/en/looking-at-mysql-8-with-postgresql-goggles-on/
    >
    > how about this:
    >
    > => \h analyze
    > Command:     ANALYZE
    > Description: collect statistics about a database
    > Syntax:
    > ANALYZE [ ( option [, ...] ) ] [ table_and_columns [, ...] ]
    > ANALYZE [ VERBOSE ] [ table_and_columns [, ...] ]
    >
    > where option can be one of:
    >
    >     VERBOSE
    >     SKIP_LOCKED
    >
    > and table_and_columns is:
    >
    >     table_name [ ( column_name [, ...] ) ]
    >
    > URL: https://www.postgresql.org/docs/12/sql-analyze.html
    > ^^^^
    >
    > (Won't actually work because the web site isn't serving "12" URLs yet,
    > but that's something that could probably be sorted out.)
    >
    
    Why not? It can be useful
    
    Pavel
    
    
    > --
    > Peter Eisentraut              http://www.2ndQuadrant.com/
    > PostgreSQL Development, 24x7 Support, Remote DBA, Training & Services
    >
    >
    
  3. Re: psql show URL with help

    Julien Rouhaud <rjuju123@gmail.com> — 2019-02-21T17:41:45Z

    On Thu, Feb 21, 2019 at 6:33 PM Pavel Stehule <pavel.stehule@gmail.com> wrote:
    >
    > čt 21. 2. 2019 v 18:28 odesílatel Peter Eisentraut <peter.eisentraut@2ndquadrant.com> napsal:
    >>
    >> As mentioned on
    >>
    >> https://www.cybertec-postgresql.com/en/looking-at-mysql-8-with-postgresql-goggles-on/
    >>
    >> how about this:
    >>
    >> => \h analyze
    >> Command:     ANALYZE
    >> Description: collect statistics about a database
    >> Syntax:
    >> ANALYZE [ ( option [, ...] ) ] [ table_and_columns [, ...] ]
    >> ANALYZE [ VERBOSE ] [ table_and_columns [, ...] ]
    >>
    >> where option can be one of:
    >>
    >>     VERBOSE
    >>     SKIP_LOCKED
    >>
    >> and table_and_columns is:
    >>
    >>     table_name [ ( column_name [, ...] ) ]
    >>
    >> URL: https://www.postgresql.org/docs/12/sql-analyze.html
    >> ^^^^
    >>
    >> (Won't actually work because the web site isn't serving "12" URLs yet,
    >> but that's something that could probably be sorted out.)
    >
    >
    > Why not? It can be useful
    
    Or just use the devel version for not-released-yet versions?
    
    
    
  4. Re: psql show URL with help

    David Fetter <david@fetter.org> — 2019-02-21T23:07:22Z

    On Thu, Feb 21, 2019 at 06:28:09PM +0100, Peter Eisentraut wrote:
    > As mentioned on
    > 
    > https://www.cybertec-postgresql.com/en/looking-at-mysql-8-with-postgresql-goggles-on/
    > 
    > how about this:
    > 
    > => \h analyze
    > Command:     ANALYZE
    > Description: collect statistics about a database
    > Syntax:
    > ANALYZE [ ( option [, ...] ) ] [ table_and_columns [, ...] ]
    > ANALYZE [ VERBOSE ] [ table_and_columns [, ...] ]
    > 
    > where option can be one of:
    > 
    >     VERBOSE
    >     SKIP_LOCKED
    > 
    > and table_and_columns is:
    > 
    >     table_name [ ( column_name [, ...] ) ]
    > 
    > URL: https://www.postgresql.org/docs/12/sql-analyze.html
    > ^^^^
    > 
    > (Won't actually work because the web site isn't serving "12" URLs yet,
    > but that's something that could probably be sorted out.)
    
    Since there's no longer any mystery as to what the upcoming major
    version of PostgreSQL will be, it should be pretty straightforward to
    redirect integers > max(released version) to the devel docs.
    
    This could cause some confusion because we branch long (feature- and
    bug-wise) before we do the release, and a checkout from immediately
    after branching will be *very* different from one just before the
    release. The way I've come up with to clear this up is *way* too
    expensive: lazily create doc builds for each SHA1 requested.  Pointing
    people at the latest devel docs is less confusing than pointing them
    at nothing or at the previous version, those being, as far as I can
    tell, the viable alternatives.
    
    Best,
    David.
    -- 
    David Fetter <david(at)fetter(dot)org> http://fetter.org/
    Phone: +1 415 235 3778
    
    Remember to vote!
    Consider donating to Postgres: http://www.postgresql.org/about/donate
    
    
    
  5. Re: psql show URL with help

    Magnus Hagander <magnus@hagander.net> — 2019-02-22T11:07:45Z

    On Thu, Feb 21, 2019 at 6:28 PM Peter Eisentraut <
    peter.eisentraut@2ndquadrant.com> wrote:
    
    > As mentioned on
    >
    >
    > https://www.cybertec-postgresql.com/en/looking-at-mysql-8-with-postgresql-goggles-on/
    >
    > how about this:
    >
    > => \h analyze
    > Command:     ANALYZE
    > Description: collect statistics about a database
    > Syntax:
    > ANALYZE [ ( option [, ...] ) ] [ table_and_columns [, ...] ]
    > ANALYZE [ VERBOSE ] [ table_and_columns [, ...] ]
    >
    > where option can be one of:
    >
    >     VERBOSE
    >     SKIP_LOCKED
    >
    > and table_and_columns is:
    >
    >     table_name [ ( column_name [, ...] ) ]
    >
    > URL: https://www.postgresql.org/docs/12/sql-analyze.html
    > ^^^^
    >
    >
    I've had doing this on my TODO for a few years, but never managed to get
    around to it. So strong +1 for the idea :)
    
    
    
    > (Won't actually work because the web site isn't serving "12" URLs yet,
    > but that's something that could probably be sorted out.)
    >
    
    Why not just link to /devel/ when it's a devel version? The 12 docs will be
    up alongside the first beta version, so it should be perfectly possible to
    have it do that based on information from configure, no?
    
    -- 
     Magnus Hagander
     Me: https://www.hagander.net/ <http://www.hagander.net/>
     Work: https://www.redpill-linpro.com/ <http://www.redpill-linpro.com/>
    
  6. Re: psql show URL with help

    Euler Taveira <euler@timbira.com.br> — 2019-02-22T14:37:08Z

    Em qui, 21 de fev de 2019 às 14:28, Peter Eisentraut
    <peter.eisentraut@2ndquadrant.com> escreveu:
    >
    > URL: https://www.postgresql.org/docs/12/sql-analyze.html
    > ^^^^
    >
    What happen if I connect to an old server? Did it print URL according
    to psql version or server version? psql prints help about its version
    and if user wants details about a command, clicks in the URL but what
    is shown is 12 docs but user is accessing a 9.4 server. Ops... the
    command failed. Check the URL again but... wait it is not 9.4 docs.
    There is also the case that some commands don't exist on old versions
    but URL will be printed. IMHO URL should be printed iif psql version
    is the same as server version. If we want flexibility, let's add an
    option to enable URL exhibition (always/same) that defaults to same.
    
    
    -- 
       Euler Taveira                                   Timbira -
    http://www.timbira.com.br/
       PostgreSQL: Consultoria, Desenvolvimento, Suporte 24x7 e Treinamento
    
    
    
  7. Re: psql show URL with help

    Peter Eisentraut <peter.eisentraut@2ndquadrant.com> — 2019-02-22T14:50:17Z

    On 2019-02-22 15:37, Euler Taveira wrote:
    > Em qui, 21 de fev de 2019 às 14:28, Peter Eisentraut
    > <peter.eisentraut@2ndquadrant.com> escreveu:
    >> URL: https://www.postgresql.org/docs/12/sql-analyze.html
    >> ^^^^
    >>
    > What happen if I connect to an old server? Did it print URL according
    > to psql version or server version? psql prints help about its version
    > and if user wants details about a command, clicks in the URL but what
    > is shown is 12 docs but user is accessing a 9.4 server. Ops... the
    > command failed. Check the URL again but... wait it is not 9.4 docs.
    
    Well, the help that currently displays is also hardcoded to the psql
    version.  At least this way it would indicate in the URL that it might
    pertain to a different version.
    
    -- 
    Peter Eisentraut              http://www.2ndQuadrant.com/
    PostgreSQL Development, 24x7 Support, Remote DBA, Training & Services
    
    
    
  8. Re: psql show URL with help

    Tom Lane <tgl@sss.pgh.pa.us> — 2019-02-22T14:55:27Z

    Euler Taveira <euler@timbira.com.br> writes:
    > Em qui, 21 de fev de 2019 às 14:28, Peter Eisentraut
    > <peter.eisentraut@2ndquadrant.com> escreveu:
    >> URL: https://www.postgresql.org/docs/12/sql-analyze.html
    
    > What happen if I connect to an old server? Did it print URL according
    > to psql version or server version? psql prints help about its version
    > and if user wants details about a command, clicks in the URL but what
    > is shown is 12 docs but user is accessing a 9.4 server.
    
    The syntax summary that psql is showing is for its own version, and
    I'd say the URL must be too.  You can't even be sure that a corresponding
    URL would exist in another version, so blindly inserting the server's
    major version into a URL string that psql has doesn't seem like a bright
    idea.
    
    (I'm assuming that the implementation Peter has in mind is that these
    URLs would just be part of the prefab help text that psql has for
    various commands.  If we somehow involved the server in it, then
    maybe things could be different; but I doubt that's possible without
    a protocol change, which it's probably not worth.)
    
    In the end, if you are using a server version that's different from
    your psql version, there are lots of ways things could go wrong.
    I think it's up to the user to take psql's help with a grain of salt
    in such cases.
    
    			regards, tom lane
    
    
    
  9. Re: psql show URL with help

    Euler Taveira <euler@timbira.com.br> — 2019-02-22T15:10:20Z

    Em sex, 22 de fev de 2019 às 11:55, Tom Lane <tgl@sss.pgh.pa.us> escreveu:
    >
    > The syntax summary that psql is showing is for its own version, and
    > I'd say the URL must be too.  You can't even be sure that a corresponding
    > URL would exist in another version, so blindly inserting the server's
    > major version into a URL string that psql has doesn't seem like a bright
    > idea.
    >
    I'm not suggesting that we replace version number using the latest
    version URL. However, we could prevent URL to be shown if the version
    mismatch. If psql wasn't backward compatible we shouldn't care but it
    is. Someone could be confused as I said earlier.
    
    
    -- 
       Euler Taveira                                   Timbira -
    http://www.timbira.com.br/
       PostgreSQL: Consultoria, Desenvolvimento, Suporte 24x7 e Treinamento
    
    
    
  10. Re: psql show URL with help

    Tom Lane <tgl@sss.pgh.pa.us> — 2019-02-22T17:40:31Z

    Euler Taveira <euler@timbira.com.br> writes:
    > I'm not suggesting that we replace version number using the latest
    > version URL. However, we could prevent URL to be shown if the version
    > mismatch. If psql wasn't backward compatible we shouldn't care but it
    > is. Someone could be confused as I said earlier.
    
    I tend to agree with Peter that showing the URL is actually better
    than not doing so, in such a case --- it might remind the user
    which version the help text is for.
    
    			regards, tom lane
    
    
    
  11. Re: psql show URL with help

    Peter Eisentraut <peter.eisentraut@2ndquadrant.com> — 2019-02-25T11:05:29Z

    On 2019-02-21 18:28, Peter Eisentraut wrote:
    > => \h analyze
    
    > URL: https://www.postgresql.org/docs/12/sql-analyze.html
    > ^^^^
    
    Here is a patch.
    
    It doesn't deal with the "devel" paths yet.  Discussion there is still
    ongoing a bit.
    
    -- 
    Peter Eisentraut              http://www.2ndQuadrant.com/
    PostgreSQL Development, 24x7 Support, Remote DBA, Training & Services
    
  12. Re: psql show URL with help

    Peter Eisentraut <peter.eisentraut@2ndquadrant.com> — 2019-02-25T11:06:32Z

    On 2019-02-22 12:07, Magnus Hagander wrote:
    >     (Won't actually work because the web site isn't serving "12" URLs yet,
    >     but that's something that could probably be sorted out.)
    > 
    > 
    > Why not just link to /devel/ when it's a devel version? The 12 docs will
    > be up alongside the first beta version, so it should be perfectly
    > possible to have it do that based on information from configure, no?
    
    Why not just serve /12/ from the web site earlier?  Is there a reason
    not to?
    
    -- 
    Peter Eisentraut              http://www.2ndQuadrant.com/
    PostgreSQL Development, 24x7 Support, Remote DBA, Training & Services
    
    
    
  13. Re: psql show URL with help

    Pavel Stehule <pavel.stehule@gmail.com> — 2019-02-25T11:29:21Z

    po 25. 2. 2019 v 12:06 odesílatel Peter Eisentraut <
    peter.eisentraut@2ndquadrant.com> napsal:
    
    > On 2019-02-22 12:07, Magnus Hagander wrote:
    > >     (Won't actually work because the web site isn't serving "12" URLs
    > yet,
    > >     but that's something that could probably be sorted out.)
    > >
    > >
    > > Why not just link to /devel/ when it's a devel version? The 12 docs will
    > > be up alongside the first beta version, so it should be perfectly
    > > possible to have it do that based on information from configure, no?
    >
    > Why not just serve /12/ from the web site earlier?  Is there a reason
    > not to?
    >
    
    I had same idea. The fact so this version is development version, can be
    solved by some styles.
    
    But a URL should be stable.
    
    Regards
    
    Pavel
    
    
    > --
    > Peter Eisentraut              http://www.2ndQuadrant.com/
    > PostgreSQL Development, 24x7 Support, Remote DBA, Training & Services
    >
    >
    
  14. Re: psql show URL with help

    Peter Eisentraut <peter.eisentraut@2ndquadrant.com> — 2019-02-27T08:14:59Z

    On 2019-02-25 12:05, Peter Eisentraut wrote:
    > On 2019-02-21 18:28, Peter Eisentraut wrote:
    >> => \h analyze
    > 
    >> URL: https://www.postgresql.org/docs/12/sql-analyze.html
    >> ^^^^
    > 
    > Here is a patch.
    > 
    > It doesn't deal with the "devel" paths yet.  Discussion there is still
    > ongoing a bit.
    
    A new patch that now handles the "devel" part.  Seems easy enough.
    
    -- 
    Peter Eisentraut              http://www.2ndQuadrant.com/
    PostgreSQL Development, 24x7 Support, Remote DBA, Training & Services
    
  15. Re: psql show URL with help

    David Fetter <david@fetter.org> — 2019-03-03T18:14:32Z

    On Wed, Feb 27, 2019 at 09:14:59AM +0100, Peter Eisentraut wrote:
    > +					url = psprintf("https://www.postgresql.org/docs/%s/%s.html",
    > +								   strstr(PG_VERSION, "devel") ? "devel" : PG_MAJORVERSION,
    > +								   QL_HELP[i].docbook_id);
    
    Do we need to make sure that the docs are published under the major
    version as soon as we get to alpha, or do we need something more like
    this?
    
        url = psprintf("https://www.postgresql.org/docs/%s/%s.html",
                (strstr(PG_VERSION, "devel") || strstr(PG_VERSION, "beta") ||
                 strstr(PG_VERSION, "alpha")) : "devel" : PG_MAJORVERSION,
                QL_HELP[i].docbook_id);
    
    
    Best,
    David.
    -- 
    David Fetter <david(at)fetter(dot)org> http://fetter.org/
    Phone: +1 415 235 3778
    
    Remember to vote!
    Consider donating to Postgres: http://www.postgresql.org/about/donate
    
    
    
  16. Re: psql show URL with help

    Ramanarayana <raam.soft@gmail.com> — 2019-03-03T20:55:35Z

    Hi,
    Is there any documentation change required for this patch?
    Cheers
    Ram 4.0
    
  17. Re: psql show URL with help

    Magnus Hagander <magnus@hagander.net> — 2019-03-03T20:57:25Z

    On Sun, Mar 3, 2019 at 7:14 PM David Fetter <david@fetter.org> wrote:
    
    > On Wed, Feb 27, 2019 at 09:14:59AM +0100, Peter Eisentraut wrote:
    > > +                                     url = psprintf("
    > https://www.postgresql.org/docs/%s/%s.html",
    > > +
    > strstr(PG_VERSION, "devel") ? "devel" : PG_MAJORVERSION,
    > > +
    > QL_HELP[i].docbook_id);
    >
    > Do we need to make sure that the docs are published under the major
    > version as soon as we get to alpha, or do we need something more like
    > this?
    >
    >     url = psprintf("https://www.postgresql.org/docs/%s/%s.html",
    >             (strstr(PG_VERSION, "devel") || strstr(PG_VERSION, "beta") ||
    >              strstr(PG_VERSION, "alpha")) : "devel" : PG_MAJORVERSION,
    >             QL_HELP[i].docbook_id);
    >
    
    We don't really release alphas any more. And we do load the documentation
    alongside the betas. (Last time we did an alpha was so long ago I don't
    remember if we loaded docs)
    
    -- 
     Magnus Hagander
     Me: https://www.hagander.net/ <http://www.hagander.net/>
     Work: https://www.redpill-linpro.com/ <http://www.redpill-linpro.com/>
    
  18. Re: psql show URL with help

    David Fetter <david@fetter.org> — 2019-03-03T21:48:33Z

    On Sun, Mar 03, 2019 at 09:57:25PM +0100, Magnus Hagander wrote:
    > On Sun, Mar 3, 2019 at 7:14 PM David Fetter <david@fetter.org> wrote:
    > 
    > > On Wed, Feb 27, 2019 at 09:14:59AM +0100, Peter Eisentraut wrote:
    > > > +                                     url = psprintf("
    > > https://www.postgresql.org/docs/%s/%s.html",
    > > > +
    > > strstr(PG_VERSION, "devel") ? "devel" : PG_MAJORVERSION,
    > > > +
    > > QL_HELP[i].docbook_id);
    > >
    > > Do we need to make sure that the docs are published under the major
    > > version as soon as we get to alpha, or do we need something more like
    > > this?
    > >
    > >     url = psprintf("https://www.postgresql.org/docs/%s/%s.html",
    > >             (strstr(PG_VERSION, "devel") || strstr(PG_VERSION, "beta") ||
    > >              strstr(PG_VERSION, "alpha")) : "devel" : PG_MAJORVERSION,
    > >             QL_HELP[i].docbook_id);
    > >
    > 
    > We don't really release alphas any more. And we do load the documentation
    > alongside the betas. (Last time we did an alpha was so long ago I don't
    > remember if we loaded docs)
    
    If the first thing we do when we move from devel to some other state
    (beta, RC, etc.) is to publish the docs under the major version
    number, then maybe this test should be more along the lines of looking
    for anything that's neither devel nor a number, extract the number,
    and use that.
    
    Best,
    David.
    -- 
    David Fetter <david(at)fetter(dot)org> http://fetter.org/
    Phone: +1 415 235 3778
    
    Remember to vote!
    Consider donating to Postgres: http://www.postgresql.org/about/donate
    
    
    
  19. Re: psql show URL with help

    Magnus Hagander <magnus@hagander.net> — 2019-03-04T16:55:58Z

    On Sun, Mar 3, 2019 at 10:48 PM David Fetter <david@fetter.org> wrote:
    
    > On Sun, Mar 03, 2019 at 09:57:25PM +0100, Magnus Hagander wrote:
    > > On Sun, Mar 3, 2019 at 7:14 PM David Fetter <david@fetter.org> wrote:
    > >
    > > > On Wed, Feb 27, 2019 at 09:14:59AM +0100, Peter Eisentraut wrote:
    > > > > +                                     url = psprintf("
    > > > https://www.postgresql.org/docs/%s/%s.html",
    > > > > +
    > > > strstr(PG_VERSION, "devel") ? "devel" : PG_MAJORVERSION,
    > > > > +
    > > > QL_HELP[i].docbook_id);
    > > >
    > > > Do we need to make sure that the docs are published under the major
    > > > version as soon as we get to alpha, or do we need something more like
    > > > this?
    > > >
    > > >     url = psprintf("https://www.postgresql.org/docs/%s/%s.html",
    > > >             (strstr(PG_VERSION, "devel") || strstr(PG_VERSION, "beta")
    > ||
    > > >              strstr(PG_VERSION, "alpha")) : "devel" : PG_MAJORVERSION,
    > > >             QL_HELP[i].docbook_id);
    > > >
    > >
    > > We don't really release alphas any more. And we do load the documentation
    > > alongside the betas. (Last time we did an alpha was so long ago I don't
    > > remember if we loaded docs)
    >
    > If the first thing we do when we move from devel to some other state
    > (beta, RC, etc.) is to publish the docs under the major version
    > number, then maybe this test should be more along the lines of looking
    > for anything that's neither devel nor a number, extract the number,
    > and use that.
    >
    
    Well, alpha versions do go under the numeric URL. Whether we load the docs
    at that time or not we can just choose -- but there is no reason not to. So
    yeah, that sounds like it would work better.
    
    -- 
     Magnus Hagander
     Me: https://www.hagander.net/ <http://www.hagander.net/>
     Work: https://www.redpill-linpro.com/ <http://www.redpill-linpro.com/>
    
  20. Re: psql show URL with help

    Peter Eisentraut <peter.eisentraut@2ndquadrant.com> — 2019-03-05T07:41:35Z

    On 2019-03-04 17:55, Magnus Hagander wrote:
    >     If the first thing we do when we move from devel to some other state
    >     (beta, RC, etc.) is to publish the docs under the major version
    >     number, then maybe this test should be more along the lines of looking
    >     for anything that's neither devel nor a number, extract the number,
    >     and use that.
    > 
    > 
    > Well, alpha versions do go under the numeric URL. Whether we load the
    > docs at that time or not we can just choose -- but there is no reason
    > not to. So yeah, that sounds like it would work better. 
    
    Can you put your proposal in the form of some logical pseudocode?  I
    don't understand the free-form description.
    
    -- 
    Peter Eisentraut              http://www.2ndQuadrant.com/
    PostgreSQL Development, 24x7 Support, Remote DBA, Training & Services
    
    
    
  21. Re: psql show URL with help

    Magnus Hagander <magnus@hagander.net> — 2019-03-07T19:44:07Z

    On Mon, Mar 4, 2019 at 11:41 PM Peter Eisentraut <
    peter.eisentraut@2ndquadrant.com> wrote:
    
    > On 2019-03-04 17:55, Magnus Hagander wrote:
    > >     If the first thing we do when we move from devel to some other state
    > >     (beta, RC, etc.) is to publish the docs under the major version
    > >     number, then maybe this test should be more along the lines of
    > looking
    > >     for anything that's neither devel nor a number, extract the number,
    > >     and use that.
    > >
    > >
    > > Well, alpha versions do go under the numeric URL. Whether we load the
    > > docs at that time or not we can just choose -- but there is no reason
    > > not to. So yeah, that sounds like it would work better.
    >
    > Can you put your proposal in the form of some logical pseudocode?  I
    > don't understand the free-form description.
    >
    
    Hah, sorry. It's actually Davids proposal, but something like:
    
    if (psql_version_is_numeric)
     return /docs/psql_version/
    else if (psql_version ends with 'devel')
      return /docs/devel/
    else
      return /docs/{psql_version but with text stripped}/
    
    So that e.g. 12beta would return "12", as would 12rc or 12alpha. But
    12devel would return "devel".
    
    -- 
     Magnus Hagander
     Me: https://www.hagander.net/ <http://www.hagander.net/>
     Work: https://www.redpill-linpro.com/ <http://www.redpill-linpro.com/>
    
  22. Re: psql show URL with help

    David Fetter <david@fetter.org> — 2019-03-07T22:02:34Z

    On Thu, Mar 07, 2019 at 11:44:07AM -0800, Magnus Hagander wrote:
    > On Mon, Mar 4, 2019 at 11:41 PM Peter Eisentraut <
    > peter.eisentraut@2ndquadrant.com> wrote:
    > 
    > > On 2019-03-04 17:55, Magnus Hagander wrote:
    > > >     If the first thing we do when we move from devel to some other state
    > > >     (beta, RC, etc.) is to publish the docs under the major version
    > > >     number, then maybe this test should be more along the lines of
    > > looking
    > > >     for anything that's neither devel nor a number, extract the number,
    > > >     and use that.
    > > >
    > > >
    > > > Well, alpha versions do go under the numeric URL. Whether we load the
    > > > docs at that time or not we can just choose -- but there is no reason
    > > > not to. So yeah, that sounds like it would work better.
    > >
    > > Can you put your proposal in the form of some logical pseudocode?  I
    > > don't understand the free-form description.
    > >
    > 
    > Hah, sorry. It's actually Davids proposal, but something like:
    > 
    > if (psql_version_is_numeric)
    >  return /docs/psql_version/
    > else if (psql_version ends with 'devel')
    >   return /docs/devel/
    > else
    >   return /docs/{psql_version but with text stripped}/
    > 
    > So that e.g. 12beta would return "12", as would 12rc or 12alpha. But
    > 12devel would return "devel".
    
    That's exactly what I had in mind :)
    
    Best,
    David.
    -- 
    David Fetter <david(at)fetter(dot)org> http://fetter.org/
    Phone: +1 415 235 3778
    
    Remember to vote!
    Consider donating to Postgres: http://www.postgresql.org/about/donate
    
    
    
  23. Re: psql show URL with help

    Peter Eisentraut <peter.eisentraut@2ndquadrant.com> — 2019-03-08T12:45:03Z

    On 2019-03-07 23:02, David Fetter wrote:
    >> if (psql_version_is_numeric)
    >>  return /docs/psql_version/
    >> else if (psql_version ends with 'devel')
    >>   return /docs/devel/
    >> else
    >>   return /docs/{psql_version but with text stripped}/
    >>
    >> So that e.g. 12beta would return "12", as would 12rc or 12alpha. But
    >> 12devel would return "devel".
    > 
    > That's exactly what I had in mind :)
    
    The outcome of that is exactly what my patch does, but the inputs are
    different.  We have PG_MAJORVERSION, which is always a single integer,
    and PG_VERSION, which could be 10.9.8 or 11beta5 or 12devel.  The patch does
    
    if (PG_VERSION ends with 'devel')
      return /docs/devel/
    else
     return /docs/$PG_MAJORVERSION/
    
    There is no third case.  Your third case of not-numeric-and-not-devel is
    correctly covered by the else branch.
    
    -- 
    Peter Eisentraut              http://www.2ndQuadrant.com/
    PostgreSQL Development, 24x7 Support, Remote DBA, Training & Services
    
    
    
  24. Re: psql show URL with help

    David Fetter <david@fetter.org> — 2019-03-08T15:11:25Z

    On Fri, Mar 08, 2019 at 01:45:03PM +0100, Peter Eisentraut wrote:
    > On 2019-03-07 23:02, David Fetter wrote:
    > >> if (psql_version_is_numeric)
    > >>  return /docs/psql_version/
    > >> else if (psql_version ends with 'devel')
    > >>   return /docs/devel/
    > >> else
    > >>   return /docs/{psql_version but with text stripped}/
    > >>
    > >> So that e.g. 12beta would return "12", as would 12rc or 12alpha. But
    > >> 12devel would return "devel".
    > > 
    > > That's exactly what I had in mind :)
    > 
    > The outcome of that is exactly what my patch does, but the inputs are
    > different.  We have PG_MAJORVERSION, which is always a single integer,
    > and PG_VERSION, which could be 10.9.8 or 11beta5 or 12devel.  The patch does
    > 
    > if (PG_VERSION ends with 'devel')
    >   return /docs/devel/
    > else
    >  return /docs/$PG_MAJORVERSION/
    > 
    > There is no third case.  Your third case of not-numeric-and-not-devel is
    > correctly covered by the else branch.
    
    Thanks for helping me understand.
    
    Best,
    David.
    -- 
    David Fetter <david(at)fetter(dot)org> http://fetter.org/
    Phone: +1 415 235 3778
    
    Remember to vote!
    Consider donating to Postgres: http://www.postgresql.org/about/donate
    
    
    
  25. Re: psql show URL with help

    Peter Eisentraut <peter.eisentraut@2ndquadrant.com> — 2019-03-11T08:13:27Z

    On 2019-03-08 16:11, David Fetter wrote:
    >> The outcome of that is exactly what my patch does, but the inputs are
    >> different.  We have PG_MAJORVERSION, which is always a single integer,
    >> and PG_VERSION, which could be 10.9.8 or 11beta5 or 12devel.  The patch does
    >>
    >> if (PG_VERSION ends with 'devel')
    >>   return /docs/devel/
    >> else
    >>  return /docs/$PG_MAJORVERSION/
    >>
    >> There is no third case.  Your third case of not-numeric-and-not-devel is
    >> correctly covered by the else branch.
    > 
    > Thanks for helping me understand.
    
    Committed, thanks.
    
    -- 
    Peter Eisentraut              http://www.2ndQuadrant.com/
    PostgreSQL Development, 24x7 Support, Remote DBA, Training & Services