Thread: psql show URL with help
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
č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
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?
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
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?
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
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
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
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
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
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
Attachment
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
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
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
Attachment
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
Hi,
Is there any documentation change required for this patch?
Cheers
Ram 4.0
Ram 4.0
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)
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
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.
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
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".
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
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
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
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