pg.ddx.io pgsql-hackers@postgresql.org mailing list archive
help / color / mirror / Atom feedpsql show URL with help
25+ messages / 8 participants
[nested] [flat]
Commits from this thread:
2019-03-11 27f3dea648 psql: Add documentation URL to \help output
* psql show URL with help
@ 2019-02-21 17:28 Peter Eisentraut <peter.eisentraut@2ndquadrant.com>
0 siblings, 5 replies; 25+ messages in thread
From: Peter Eisentraut @ 2019-02-21 17:28 UTC (permalink / raw)
To: pgsql-hackers
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
^ permalink raw reply [nested|flat] 25+ messages in thread
* Re: psql show URL with help
@ 2019-02-21 17:32 Pavel Stehule <pavel.stehule@gmail.com>
parent: Peter Eisentraut <peter.eisentraut@2ndquadrant.com>
4 siblings, 1 reply; 25+ messages in thread
From: Pavel Stehule @ 2019-02-21 17:32 UTC (permalink / raw)
To: Peter Eisentraut <peter.eisentraut@2ndquadrant.com>; +Cc: pgsql-hackers
č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
>
>
^ permalink raw reply [nested|flat] 25+ messages in thread
* Re: psql show URL with help
@ 2019-02-21 17:41 Julien Rouhaud <rjuju123@gmail.com>
parent: Pavel Stehule <pavel.stehule@gmail.com>
0 siblings, 0 replies; 25+ messages in thread
From: Julien Rouhaud @ 2019-02-21 17:41 UTC (permalink / raw)
To: Pavel Stehule <pavel.stehule@gmail.com>; +Cc: Peter Eisentraut <peter.eisentraut@2ndquadrant.com>; pgsql-hackers
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?
^ permalink raw reply [nested|flat] 25+ messages in thread
* Re: psql show URL with help
@ 2019-02-21 23:07 David Fetter <david@fetter.org>
parent: Peter Eisentraut <peter.eisentraut@2ndquadrant.com>
4 siblings, 0 replies; 25+ messages in thread
From: David Fetter @ 2019-02-21 23:07 UTC (permalink / raw)
To: Peter Eisentraut <peter.eisentraut@2ndquadrant.com>; +Cc: pgsql-hackers
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
^ permalink raw reply [nested|flat] 25+ messages in thread
* Re: psql show URL with help
@ 2019-02-22 11:07 Magnus Hagander <magnus@hagander.net>
parent: Peter Eisentraut <peter.eisentraut@2ndquadrant.com>
4 siblings, 1 reply; 25+ messages in thread
From: Magnus Hagander @ 2019-02-22 11:07 UTC (permalink / raw)
To: Peter Eisentraut <peter.eisentraut@2ndquadrant.com>; +Cc: pgsql-hackers
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/;
^ permalink raw reply [nested|flat] 25+ messages in thread
* Re: psql show URL with help
@ 2019-02-22 14:37 Euler Taveira <euler@timbira.com.br>
parent: Peter Eisentraut <peter.eisentraut@2ndquadrant.com>
4 siblings, 2 replies; 25+ messages in thread
From: Euler Taveira @ 2019-02-22 14:37 UTC (permalink / raw)
To: Peter Eisentraut <peter.eisentraut@2ndquadrant.com>; +Cc: pgsql-hackers
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
^ permalink raw reply [nested|flat] 25+ messages in thread
* Re: psql show URL with help
@ 2019-02-22 14:50 Peter Eisentraut <peter.eisentraut@2ndquadrant.com>
parent: Euler Taveira <euler@timbira.com.br>
1 sibling, 0 replies; 25+ messages in thread
From: Peter Eisentraut @ 2019-02-22 14:50 UTC (permalink / raw)
To: Euler Taveira <euler@timbira.com.br>; +Cc: pgsql-hackers
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
^ permalink raw reply [nested|flat] 25+ messages in thread
* Re: psql show URL with help
@ 2019-02-22 14:55 Tom Lane <tgl@sss.pgh.pa.us>
parent: Euler Taveira <euler@timbira.com.br>
1 sibling, 1 reply; 25+ messages in thread
From: Tom Lane @ 2019-02-22 14:55 UTC (permalink / raw)
To: Euler Taveira <euler@timbira.com.br>; +Cc: Peter Eisentraut <peter.eisentraut@2ndquadrant.com>; pgsql-hackers
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
^ permalink raw reply [nested|flat] 25+ messages in thread
* Re: psql show URL with help
@ 2019-02-22 15:10 Euler Taveira <euler@timbira.com.br>
parent: Tom Lane <tgl@sss.pgh.pa.us>
0 siblings, 1 reply; 25+ messages in thread
From: Euler Taveira @ 2019-02-22 15:10 UTC (permalink / raw)
To: Tom Lane <tgl@sss.pgh.pa.us>; +Cc: Peter Eisentraut <peter.eisentraut@2ndquadrant.com>; pgsql-hackers
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
^ permalink raw reply [nested|flat] 25+ messages in thread
* Re: psql show URL with help
@ 2019-02-22 17:40 Tom Lane <tgl@sss.pgh.pa.us>
parent: Euler Taveira <euler@timbira.com.br>
0 siblings, 0 replies; 25+ messages in thread
From: Tom Lane @ 2019-02-22 17:40 UTC (permalink / raw)
To: Euler Taveira <euler@timbira.com.br>; +Cc: Peter Eisentraut <peter.eisentraut@2ndquadrant.com>; pgsql-hackers
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
^ permalink raw reply [nested|flat] 25+ messages in thread
* Re: psql show URL with help
@ 2019-02-25 11:05 Peter Eisentraut <peter.eisentraut@2ndquadrant.com>
parent: Peter Eisentraut <peter.eisentraut@2ndquadrant.com>
4 siblings, 1 reply; 25+ messages in thread
From: Peter Eisentraut @ 2019-02-25 11:05 UTC (permalink / raw)
To: pgsql-hackers
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
Attachments:
v1-0001-psql-Add-URL-to-help-output.patch (text/plain, 2.7K) download
From 962caa3b1a145c6f377f7e616515da5be864fcdc Mon Sep 17 00:00:00 2001
From: Peter Eisentraut <peter@eisentraut.org>
Date: Mon, 25 Feb 2019 09:55:06 +0100
Subject: [PATCH v1] psql: Add URL to \help output
---
src/bin/psql/create_help.pl | 10 ++++++++--
src/bin/psql/help.c | 7 +++++--
2 files changed, 13 insertions(+), 4 deletions(-)
diff --git a/src/bin/psql/create_help.pl b/src/bin/psql/create_help.pl
index 314bb5d87c..e8dd90d671 100644
--- a/src/bin/psql/create_help.pl
+++ b/src/bin/psql/create_help.pl
@@ -64,6 +64,7 @@
{
const char *cmd; /* the command name */
const char *help; /* the help associated with it */
+ const char *docbook_id; /* DocBook XML id (for generating URL) */
void (*syntaxfunc)(PQExpBuffer); /* function that prints the syntax associated with it */
int nl_count; /* number of newlines in syntax (for pager) */
};
@@ -92,7 +93,7 @@
foreach my $file (sort readdir DIR)
{
- my (@cmdnames, $cmddesc, $cmdsynopsis);
+ my ($cmdid, @cmdnames, $cmddesc, $cmdsynopsis);
$file =~ /\.sgml$/ or next;
open(my $fh, '<', "$docdir/$file") or next;
@@ -104,6 +105,9 @@
m!<refmiscinfo>\s*SQL - Language Statements\s*</refmiscinfo>!i
or next;
+ $filecontent =~ m!<refentry id="([a-z-]+)">!
+ and $cmdid = $1;
+
# Collect multiple refnames
LOOP:
{
@@ -116,7 +120,7 @@
$filecontent =~ m!<synopsis>\s*(.+?)\s*</synopsis>!is
and $cmdsynopsis = $1;
- if (@cmdnames && $cmddesc && $cmdsynopsis)
+ if (@cmdnames && $cmddesc && $cmdid && $cmdsynopsis)
{
s/\"/\\"/g foreach @cmdnames;
@@ -146,6 +150,7 @@
foreach my $cmdname (@cmdnames)
{
$entries{$cmdname} = {
+ cmdid => $cmdid,
cmddesc => $cmddesc,
cmdsynopsis => $cmdsynopsis,
params => \@params,
@@ -188,6 +193,7 @@
$id =~ s/ /_/g;
print $cfile_handle " { \"$_\",
N_(\"$entries{$_}{cmddesc}\"),
+ \"$entries{$_}{cmdid}\",
sql_help_$id,
$entries{$_}{nl_count} },
diff --git a/src/bin/psql/help.c b/src/bin/psql/help.c
index 7c6fa2c590..4fbc4dde91 100644
--- a/src/bin/psql/help.c
+++ b/src/bin/psql/help.c
@@ -627,10 +627,13 @@ helpSQL(const char *topic, unsigned short int pager)
help_found = true;
fprintf(output, _("Command: %s\n"
"Description: %s\n"
- "Syntax:\n%s\n\n"),
+ "Syntax:\n%s\n\n"
+ "URL: https://www.postgresql.org/docs/%s/%s.html\n\n"),
QL_HELP[i].cmd,
_(QL_HELP[i].help),
- buffer.data);
+ buffer.data,
+ PG_MAJORVERSION,
+ QL_HELP[i].docbook_id);
/* If we have an exact match, exit. Fixes \h SELECT */
if (pg_strcasecmp(topic, QL_HELP[i].cmd) == 0)
break;
--
2.20.1
^ permalink raw reply [nested|flat] 25+ messages in thread
* Re: psql show URL with help
@ 2019-02-25 11:06 Peter Eisentraut <peter.eisentraut@2ndquadrant.com>
parent: Magnus Hagander <magnus@hagander.net>
0 siblings, 1 reply; 25+ messages in thread
From: Peter Eisentraut @ 2019-02-25 11:06 UTC (permalink / raw)
To: Magnus Hagander <magnus@hagander.net>; +Cc: pgsql-hackers
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
^ permalink raw reply [nested|flat] 25+ messages in thread
* Re: psql show URL with help
@ 2019-02-25 11:29 Pavel Stehule <pavel.stehule@gmail.com>
parent: Peter Eisentraut <peter.eisentraut@2ndquadrant.com>
0 siblings, 0 replies; 25+ messages in thread
From: Pavel Stehule @ 2019-02-25 11:29 UTC (permalink / raw)
To: Peter Eisentraut <peter.eisentraut@2ndquadrant.com>; +Cc: Magnus Hagander <magnus@hagander.net>; pgsql-hackers
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
>
>
^ permalink raw reply [nested|flat] 25+ messages in thread
* Re: psql show URL with help
@ 2019-02-27 08:14 Peter Eisentraut <peter.eisentraut@2ndquadrant.com>
parent: Peter Eisentraut <peter.eisentraut@2ndquadrant.com>
0 siblings, 1 reply; 25+ messages in thread
From: Peter Eisentraut @ 2019-02-27 08:14 UTC (permalink / raw)
To: pgsql-hackers
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
Attachments:
v2-0001-psql-Add-documentation-URL-to-help-output.patch (text/plain, 3.0K) download
From 8268421dd39f413e21ce3e935eee1d0b5e607db2 Mon Sep 17 00:00:00 2001
From: Peter Eisentraut <peter@eisentraut.org>
Date: Wed, 27 Feb 2019 09:09:21 +0100
Subject: [PATCH v2] psql: Add documentation URL to \help output
---
src/bin/psql/create_help.pl | 10 ++++++++--
src/bin/psql/help.c | 11 +++++++++--
2 files changed, 17 insertions(+), 4 deletions(-)
diff --git a/src/bin/psql/create_help.pl b/src/bin/psql/create_help.pl
index 314bb5d87c..e8dd90d671 100644
--- a/src/bin/psql/create_help.pl
+++ b/src/bin/psql/create_help.pl
@@ -64,6 +64,7 @@
{
const char *cmd; /* the command name */
const char *help; /* the help associated with it */
+ const char *docbook_id; /* DocBook XML id (for generating URL) */
void (*syntaxfunc)(PQExpBuffer); /* function that prints the syntax associated with it */
int nl_count; /* number of newlines in syntax (for pager) */
};
@@ -92,7 +93,7 @@
foreach my $file (sort readdir DIR)
{
- my (@cmdnames, $cmddesc, $cmdsynopsis);
+ my ($cmdid, @cmdnames, $cmddesc, $cmdsynopsis);
$file =~ /\.sgml$/ or next;
open(my $fh, '<', "$docdir/$file") or next;
@@ -104,6 +105,9 @@
m!<refmiscinfo>\s*SQL - Language Statements\s*</refmiscinfo>!i
or next;
+ $filecontent =~ m!<refentry id="([a-z-]+)">!
+ and $cmdid = $1;
+
# Collect multiple refnames
LOOP:
{
@@ -116,7 +120,7 @@
$filecontent =~ m!<synopsis>\s*(.+?)\s*</synopsis>!is
and $cmdsynopsis = $1;
- if (@cmdnames && $cmddesc && $cmdsynopsis)
+ if (@cmdnames && $cmddesc && $cmdid && $cmdsynopsis)
{
s/\"/\\"/g foreach @cmdnames;
@@ -146,6 +150,7 @@
foreach my $cmdname (@cmdnames)
{
$entries{$cmdname} = {
+ cmdid => $cmdid,
cmddesc => $cmddesc,
cmdsynopsis => $cmdsynopsis,
params => \@params,
@@ -188,6 +193,7 @@
$id =~ s/ /_/g;
print $cfile_handle " { \"$_\",
N_(\"$entries{$_}{cmddesc}\"),
+ \"$entries{$_}{cmdid}\",
sql_help_$id,
$entries{$_}{nl_count} },
diff --git a/src/bin/psql/help.c b/src/bin/psql/help.c
index 7c6fa2c590..6b781afc6c 100644
--- a/src/bin/psql/help.c
+++ b/src/bin/psql/help.c
@@ -621,16 +621,23 @@ helpSQL(const char *topic, unsigned short int pager)
strcmp(topic, "*") == 0)
{
PQExpBufferData buffer;
+ char *url;
initPQExpBuffer(&buffer);
QL_HELP[i].syntaxfunc(&buffer);
help_found = true;
+ url = psprintf("https://www.postgresql.org/docs/%s/%s.html",
+ strstr(PG_VERSION, "devel") ? "devel" : PG_MAJORVERSION,
+ QL_HELP[i].docbook_id);
fprintf(output, _("Command: %s\n"
"Description: %s\n"
- "Syntax:\n%s\n\n"),
+ "Syntax:\n%s\n\n"
+ "URL: %s\n\n"),
QL_HELP[i].cmd,
_(QL_HELP[i].help),
- buffer.data);
+ buffer.data,
+ url);
+ free(url);
/* If we have an exact match, exit. Fixes \h SELECT */
if (pg_strcasecmp(topic, QL_HELP[i].cmd) == 0)
break;
base-commit: bc09d5e4cc1813c9af60c4537fe7d70ed1baae11
--
2.20.1
^ permalink raw reply [nested|flat] 25+ messages in thread
* Re: psql show URL with help
@ 2019-03-03 18:14 David Fetter <david@fetter.org>
parent: Peter Eisentraut <peter.eisentraut@2ndquadrant.com>
0 siblings, 2 replies; 25+ messages in thread
From: David Fetter @ 2019-03-03 18:14 UTC (permalink / raw)
To: Peter Eisentraut <peter.eisentraut@2ndquadrant.com>; +Cc: pgsql-hackers
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
^ permalink raw reply [nested|flat] 25+ messages in thread
* Re: psql show URL with help
@ 2019-03-03 20:55 Ramanarayana <raam.soft@gmail.com>
parent: David Fetter <david@fetter.org>
1 sibling, 0 replies; 25+ messages in thread
From: Ramanarayana @ 2019-03-03 20:55 UTC (permalink / raw)
To: David Fetter <david@fetter.org>; +Cc: Peter Eisentraut <peter.eisentraut@2ndquadrant.com>; pgsql-hackers
Hi,
Is there any documentation change required for this patch?
Cheers
Ram 4.0
^ permalink raw reply [nested|flat] 25+ messages in thread
* Re: psql show URL with help
@ 2019-03-03 20:57 Magnus Hagander <magnus@hagander.net>
parent: David Fetter <david@fetter.org>
1 sibling, 1 reply; 25+ messages in thread
From: Magnus Hagander @ 2019-03-03 20:57 UTC (permalink / raw)
To: David Fetter <david@fetter.org>; +Cc: Peter Eisentraut <peter.eisentraut@2ndquadrant.com>; pgsql-hackers
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/;
^ permalink raw reply [nested|flat] 25+ messages in thread
* Re: psql show URL with help
@ 2019-03-03 21:48 David Fetter <david@fetter.org>
parent: Magnus Hagander <magnus@hagander.net>
0 siblings, 1 reply; 25+ messages in thread
From: David Fetter @ 2019-03-03 21:48 UTC (permalink / raw)
To: Magnus Hagander <magnus@hagander.net>; +Cc: Peter Eisentraut <peter.eisentraut@2ndquadrant.com>; pgsql-hackers
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
^ permalink raw reply [nested|flat] 25+ messages in thread
* Re: psql show URL with help
@ 2019-03-04 16:55 Magnus Hagander <magnus@hagander.net>
parent: David Fetter <david@fetter.org>
0 siblings, 1 reply; 25+ messages in thread
From: Magnus Hagander @ 2019-03-04 16:55 UTC (permalink / raw)
To: David Fetter <david@fetter.org>; +Cc: Peter Eisentraut <peter.eisentraut@2ndquadrant.com>; pgsql-hackers
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/;
^ permalink raw reply [nested|flat] 25+ messages in thread
* Re: psql show URL with help
@ 2019-03-05 07:41 Peter Eisentraut <peter.eisentraut@2ndquadrant.com>
parent: Magnus Hagander <magnus@hagander.net>
0 siblings, 1 reply; 25+ messages in thread
From: Peter Eisentraut @ 2019-03-05 07:41 UTC (permalink / raw)
To: Magnus Hagander <magnus@hagander.net>; David Fetter <david@fetter.org>; +Cc: pgsql-hackers
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
^ permalink raw reply [nested|flat] 25+ messages in thread
* Re: psql show URL with help
@ 2019-03-07 19:44 Magnus Hagander <magnus@hagander.net>
parent: Peter Eisentraut <peter.eisentraut@2ndquadrant.com>
0 siblings, 1 reply; 25+ messages in thread
From: Magnus Hagander @ 2019-03-07 19:44 UTC (permalink / raw)
To: Peter Eisentraut <peter.eisentraut@2ndquadrant.com>; +Cc: David Fetter <david@fetter.org>; pgsql-hackers
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/;
^ permalink raw reply [nested|flat] 25+ messages in thread
* Re: psql show URL with help
@ 2019-03-07 22:02 David Fetter <david@fetter.org>
parent: Magnus Hagander <magnus@hagander.net>
0 siblings, 1 reply; 25+ messages in thread
From: David Fetter @ 2019-03-07 22:02 UTC (permalink / raw)
To: Magnus Hagander <magnus@hagander.net>; +Cc: Peter Eisentraut <peter.eisentraut@2ndquadrant.com>; pgsql-hackers
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
^ permalink raw reply [nested|flat] 25+ messages in thread
* Re: psql show URL with help
@ 2019-03-08 12:45 Peter Eisentraut <peter.eisentraut@2ndquadrant.com>
parent: David Fetter <david@fetter.org>
0 siblings, 1 reply; 25+ messages in thread
From: Peter Eisentraut @ 2019-03-08 12:45 UTC (permalink / raw)
To: David Fetter <david@fetter.org>; Magnus Hagander <magnus@hagander.net>; +Cc: pgsql-hackers
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
^ permalink raw reply [nested|flat] 25+ messages in thread
* Re: psql show URL with help
@ 2019-03-08 15:11 David Fetter <david@fetter.org>
parent: Peter Eisentraut <peter.eisentraut@2ndquadrant.com>
0 siblings, 1 reply; 25+ messages in thread
From: David Fetter @ 2019-03-08 15:11 UTC (permalink / raw)
To: Peter Eisentraut <peter.eisentraut@2ndquadrant.com>; +Cc: Magnus Hagander <magnus@hagander.net>; pgsql-hackers
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
^ permalink raw reply [nested|flat] 25+ messages in thread
* Re: psql show URL with help
@ 2019-03-11 08:13 Peter Eisentraut <peter.eisentraut@2ndquadrant.com>
parent: David Fetter <david@fetter.org>
0 siblings, 0 replies; 25+ messages in thread
From: Peter Eisentraut @ 2019-03-11 08:13 UTC (permalink / raw)
To: David Fetter <david@fetter.org>; +Cc: Magnus Hagander <magnus@hagander.net>; pgsql-hackers
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
^ permalink raw reply [nested|flat] 25+ messages in thread
end of thread, other threads:[~2019-03-11 08:13 UTC | newest]
Thread overview: 25+ messages (download: mbox mbox.gz follow: Atom feed)
-- links below jump to the message on this page --
2019-02-21 17:28 psql show URL with help Peter Eisentraut <peter.eisentraut@2ndquadrant.com>
2019-02-21 17:32 ` Pavel Stehule <pavel.stehule@gmail.com>
2019-02-21 17:41 ` Julien Rouhaud <rjuju123@gmail.com>
2019-02-21 23:07 ` David Fetter <david@fetter.org>
2019-02-22 11:07 ` Magnus Hagander <magnus@hagander.net>
2019-02-25 11:06 ` Peter Eisentraut <peter.eisentraut@2ndquadrant.com>
2019-02-25 11:29 ` Pavel Stehule <pavel.stehule@gmail.com>
2019-02-22 14:37 ` Euler Taveira <euler@timbira.com.br>
2019-02-22 14:50 ` Peter Eisentraut <peter.eisentraut@2ndquadrant.com>
2019-02-22 14:55 ` Tom Lane <tgl@sss.pgh.pa.us>
2019-02-22 15:10 ` Euler Taveira <euler@timbira.com.br>
2019-02-22 17:40 ` Tom Lane <tgl@sss.pgh.pa.us>
2019-02-25 11:05 ` Peter Eisentraut <peter.eisentraut@2ndquadrant.com>
2019-02-27 08:14 ` Peter Eisentraut <peter.eisentraut@2ndquadrant.com>
2019-03-03 18:14 ` David Fetter <david@fetter.org>
2019-03-03 20:55 ` Ramanarayana <raam.soft@gmail.com>
2019-03-03 20:57 ` Magnus Hagander <magnus@hagander.net>
2019-03-03 21:48 ` David Fetter <david@fetter.org>
2019-03-04 16:55 ` Magnus Hagander <magnus@hagander.net>
2019-03-05 07:41 ` Peter Eisentraut <peter.eisentraut@2ndquadrant.com>
2019-03-07 19:44 ` Magnus Hagander <magnus@hagander.net>
2019-03-07 22:02 ` David Fetter <david@fetter.org>
2019-03-08 12:45 ` Peter Eisentraut <peter.eisentraut@2ndquadrant.com>
2019-03-08 15:11 ` David Fetter <david@fetter.org>
2019-03-11 08:13 ` Peter Eisentraut <peter.eisentraut@2ndquadrant.com>
This inbox is served by DDX for PostgreSQL; see mirroring instructions
for how to clone and mirror all data and code used for this inbox