2.4 Tutorial COPY weather.txt -- From where?

2025-07-05 Thread PG Doc comments form
The following documentation comment has been logged on the website:

Page: https://www.postgresql.org/docs/17/tutorial-populate.html
Description:

I'm trying to read the docs/tutorial from start to finish, and I made it to
the end of "2.4. Populating a Table With Rows" before getting confused.  and
see `COPY weather FROM '/home/user/weather.txt';` referenced as an
alternative example to running all the individual inserts. This confused me
because I spent time looking for a link to download this, and eventually
skimming through /src/tutorial/* on github, and couldn't find it anywhere.
Now I'm thinking it doesn't exist anywhere, but it would be nice if (A) it
was specified explicitly that this example file doesn't exist anywhere for
download, or (B) provide a link to the github or similar where a plain text
file can be downloaded for loading tutorial datasets.
Thank you, and happy 4th of July


Re: Missing File weather.txt

2025-07-05 Thread Fujii Masao




On 2020/01/28 19:18, Daniel Gustafsson wrote:

On 28 Jan 2020, at 03:22, PG Doc comments form  wrote:

The following documentation comment has been logged on the website:

Page: https://www.postgresql.org/docs/12/tutorial-populate.html
Description:

On this page https://www.postgresql.org/docs/12/tutorial-populate.html you
have this command:

COPY weather FROM '/home/user/weather.txt';

I've searched all over for weather.txt and can't find it. Please could you
make this and any other files required for the tutorial available and
provide clear instructions for accessing them at the beginning of the
tutorial.


This is only mentioned as an example of another input method, with a link to
the COPY page for more information.  That being said, it's a good thing for a
tutorial to be self-contained, and going from a basic tutorial to the COPY
reference page is a fairly large step.  I propose that we add a small example
on what weather.txt could look like as per the attached diff.


Sorry for reviving this old thread, but I wanted to follow up since
the same issue was reported again in [1], and the proposed patch
basically looks good to me.

Regarding the patch:

+
+San Francisco46500.251994-11-27
+Hayward37540.01994-11-29
+


In the tutorial, three rows are inserted using INSERT, so shouldn't
the sample input for COPY include all three, like this?

San Francisco   46  50  0.251994-11-27
San Francisco   43  57  0   1994-11-29
Hayward 37  54  \N  1994-11-29

Regards,

[1] 
https://postgr.es/m/175166227769.3157504.1136715805440673...@wrigleys.postgresql.org

--
Fujii Masao
NTT DATA Japan Corporation





Re: Missing File weather.txt

2025-07-05 Thread Tom Lane
Fujii Masao  writes:
> On 2020/01/28 19:18, Daniel Gustafsson wrote:
>> This is only mentioned as an example of another input method, with a link to
>> the COPY page for more information.  That being said, it's a good thing for a
>> tutorial to be self-contained, and going from a basic tutorial to the COPY
>> reference page is a fairly large step.  I propose that we add a small example
>> on what weather.txt could look like as per the attached diff.

> Sorry for reviving this old thread, but I wanted to follow up since
> the same issue was reported again in [1], and the proposed patch
> basically looks good to me.

+1

> In the tutorial, three rows are inserted using INSERT, so shouldn't
> the sample input for COPY include all three, like this?

Agreed, the example file should match what the tutorial expects to be
in the table.  I'd include text along the lines of "The data inserted
above could also be inserted from a file containing:".

regards, tom lane