Typo in description of PROGRAM parameter for the COPY command

2022-08-21 Thread PG Doc comments form
The following documentation comment has been logged on the website:

Page: https://www.postgresql.org/docs/14/sql-copy.html
Description:

On this page https://www.postgresql.org/docs/current/sql-copy.html the
description of the PROGRAM parameter for the COPY command has the following
sentence with a minor typo:

> ...so if you need to pass any arguments to shell command that come
from an untrusted source...

The "to shell command that come" part should be changed so it either reads
like this:

> ...so if you need to pass any arguments to a shell command that comes
from an untrusted source...

...or it reads like this:

> ...so if you need to pass any arguments to shell commands that come
from an untrusted source...

Many thanks,
Eric Mutta.


Re: relpages in pg_class

2022-08-21 Thread Shangzi Xie
Page and block can be used interchangeably, but the description of relpages
in the documentation can be confusing to someone who doesn't care much
about the difference between page and block.
When I want to count pages from a table, maybe the keywords I should look
for should be "the number of", but the relpages is described by document
with "Size of".

---
Shangzi Xie


On Sat, Aug 20, 2022 at 3:16 AM Bruce Momjian  wrote:

> On Fri, Aug 19, 2022 at 11:25:52AM -0700, Peter Geoghegan wrote:
> > On Fri, Aug 19, 2022 at 9:40 AM Tom Lane  wrote:
> > > Yeah, we use "blocks" and "pages" interchangeably, which is something
> > > I don't feel a need to change; but evidently the OP didn't realize
> that.
> > > This is a job for the glossary, perhaps?
> >
> > I think that they're synonyms that can often (but not always) be used
> > interchangeably. I *think* that this understanding is shared by other
> > people, though I should check. Here goes:
> >
> > To me, "block" emphasizes on-disk/relfilenode storage. Something that
> > exists at a particular physical offset in a particular file (a
> > BlockNumber + relfilenode). On the other hand, the term "page"
> > emphasizes the in-memory format, and the indirection provided by the
> > bufpage.c slotted page format (i.e. line pointer array indirection).
>
> Yes, I have heard the block-disk, page-memory explanation before.
>
> --
>   Bruce Momjian  
> https://urldefense.proofpoint.com/v2/url?u=https-3A__momjian.us&d=DwIBAg&c=009klHSCxuh5AI1vNQzSO0KGjl4nbi2Q0M1QLJX9BeE&r=Hul745xaxWgD5ax2VcStGxXAXxES8dE1okk4lpHMoao&m=iq1O1WJgFr-Q1WqUjSdWPoPWj7Ui7sDz3fQ5njhfrwdLVNKdZ-fCeSS0TFdJUe-y&s=o-_cOvuvBdiTSvBWdgCX5noK2cE5VZBF-jETQXEA-WE&e=
>
>   EDB
> https://urldefense.proofpoint.com/v2/url?u=https-3A__enterprisedb.com&d=DwIBAg&c=009klHSCxuh5AI1vNQzSO0KGjl4nbi2Q0M1QLJX9BeE&r=Hul745xaxWgD5ax2VcStGxXAXxES8dE1okk4lpHMoao&m=iq1O1WJgFr-Q1WqUjSdWPoPWj7Ui7sDz3fQ5njhfrwdLVNKdZ-fCeSS0TFdJUe-y&s=e2Z4mi_VN2ktgB7rh3Y7N4KhPdeTi-4knCQ7yirZK1E&e=
>
>
>   Indecision is a decision.  Inaction is an action.  Mark Batterson
>
>


Re: Typo in description of PROGRAM parameter for the COPY command

2022-08-21 Thread Daniel Gustafsson
> On 21 Aug 2022, at 03:31, PG Doc comments form  wrote:

>> ...so if you need to pass any arguments to shell command that come
> from an untrusted source...
> 
> The "to shell command that come" part should be changed so it either reads
> like this:
> 
>> ...so if you need to pass any arguments to a shell command that comes
> from an untrusted source...
> 
> ...or it reads like this:
> 
>> ...so if you need to pass any arguments to shell commands that come
> from an untrusted source...

Not being a native english speaker, but since we're already referring to "the
command" in the sentence it seems more natural to me to change to "the shell
command".

--
Daniel Gustafsson   https://vmware.com/





Re: Typo in description of PROGRAM parameter for the COPY command

2022-08-21 Thread Tom Lane
Daniel Gustafsson  writes:
> On 21 Aug 2022, at 03:31, PG Doc comments form  wrote:
>> ...so if you need to pass any arguments to shell command that come
>> from an untrusted source...
>> 
>> The "to shell command that come" part should be changed so it either reads
>> like this:
>> 
>> ...so if you need to pass any arguments to a shell command that comes
>> from an untrusted source...
>> 
>> ...or it reads like this:
>> 
>> ...so if you need to pass any arguments to shell commands that come
>> from an untrusted source...

> Not being a native english speaker, but since we're already referring to "the
> command" in the sentence it seems more natural to me to change to "the shell
> command".

Hmm ... to me the main problem with this fragment is that it's not
entirely clear whether we're speaking of untrusted arguments or an
untrusted shell command, ie which one is the antecedent of "that".
The proposed variants seem to make that worse not better.  I suggest
rephrasing like

... so if you need to include any shell command arguments that come from
an untrusted source, you must ...

Or maybe even better, just drop "shell command" from that phrase
altogether.

Probably also s/passing/including/ in the next sentence.

regards, tom lane




Re: Typo in description of PROGRAM parameter for the COPY command

2022-08-21 Thread Daniel Gustafsson
> On 21 Aug 2022, at 20:48, Tom Lane  wrote:
> 
> Daniel Gustafsson  writes:
>> On 21 Aug 2022, at 03:31, PG Doc comments form  
>> wrote:
>>> ...so if you need to pass any arguments to shell command that come
>>> from an untrusted source...
>>> 
>>> The "to shell command that come" part should be changed so it either reads
>>> like this:
>>> 
>>> ...so if you need to pass any arguments to a shell command that comes
>>> from an untrusted source...
>>> 
>>> ...or it reads like this:
>>> 
>>> ...so if you need to pass any arguments to shell commands that come
>>> from an untrusted source...
> 
>> Not being a native english speaker, but since we're already referring to "the
>> command" in the sentence it seems more natural to me to change to "the shell
>> command".
> 
> Hmm ... to me the main problem with this fragment is that it's not
> entirely clear whether we're speaking of untrusted arguments or an
> untrusted shell command, ie which one is the antecedent of "that".
> The proposed variants seem to make that worse not better. I suggest
> rephrasing like
> 
> ... so if you need to include any shell command arguments that come from
> an untrusted source, you must ...
> 
> Or maybe even better, just drop "shell command" from that phrase
> altogether.
> 
> Probably also s/passing/including/ in the next sentence.

Agreed, those suggestions make it better.

Skimming the page I noticed that we wrap CSV in  in all but a few
places, which seemed randomly "chosen".  Another sentence which stood out to me
was this one on FREEZE:

"This violates the normal rules of MVCC visibility and users specifying
should be aware of the potential problems this might cause."

The use of "specifying" seems odd to me, removing it makes it read clearer
IM-non-native-O.

The attached includes all the above suggestions.

--
Daniel Gustafsson   https://vmware.com/



copy.diff
Description: Binary data


Re: Typo in description of PROGRAM parameter for the COPY command

2022-08-21 Thread Tom Lane
Daniel Gustafsson  writes:
> Skimming the page I noticed that we wrap CSV in  in all but a few
> places, which seemed randomly "chosen".  Another sentence which stood out to 
> me
> was this one on FREEZE:

>   "This violates the normal rules of MVCC visibility and users specifying
>   should be aware of the potential problems this might cause."

> The use of "specifying" seems odd to me, removing it makes it read clearer
> IM-non-native-O.

I suppose the author was aiming at "specifying it", but I agree that
just dropping "specifying" works fine with fewer words.

> The attached includes all the above suggestions.

LGTM.

regards, tom lane




Should 'sum(mvf)' read 'sum(mcv)'...?

2022-08-21 Thread PG Doc comments form
The following documentation comment has been logged on the website:

Page: https://www.postgresql.org/docs/14/row-estimation-examples.html
Description:

About halfway down this page
https://www.postgresql.org/docs/current/row-estimation-examples.html we see
the following formula for calculating selectivity:

> selectivity = (1 - sum(mvf))/(num_distinct - num_mcv)

And just below the formula we see the explanatory sentence saying:

   > That is, add up all the frequencies for the MCVs and subtract them from
one, ...

It appears the above sentence is referring to the "(1 - sum(mvf))" portion
of the formula, however I am not sure what "mvf" is referring to
there...shouldn't it be "(1 - sum(mcv))" in order to match what the
explanatory sentence is saying?

Many thanks,
Eric Mutta.