Subject: Missing File weather.txt

From: PG Doc comments form <[email-masked]>
Date: Tue, 28 Jan 2020 02:22:21 +0000

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.

Thanks.

---

From: Daniel Gustafsson <[email-masked]>
Date: Tue, 28 Jan 2020 11:18:02 +0100

> On 28 Jan 2020, at 03:22, PG Doc comments form <[email-masked]> 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.

cheers ./daniel

---

From: Fujii Masao <[email-masked]>
Date: Sun, 6 Jul 2025 02:17:50 +0900

> 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:

+<programlisting>
+San Francisco    46    50    0.25    1994-11-27
+Hayward    37    54    0.0    1994-11-29
+</programlisting>

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.25	1994-11-27
San Francisco	43	57	0	1994-11-29
Hayward	37	54	\N	1994-11-29

Regards,

[1] https://postgr.es/m/[email-masked]

-- 
Fujii Masao
NTT DATA Japan Corporation

---

From: Tom Lane <[email-masked]>
Date: Sat, 05 Jul 2025 13:29:19 -0400

> basically looks good to me.

+1

> 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

---

From: Daniel Gustafsson <[email-masked]>
Date: Fri, 11 Jul 2025 00:22:55 +0200

> On 5 Jul 2025, at 19:29, Tom Lane <[email-masked]> wrote:
> 

The attached v2 adds the missing line, and tweaks the text added to document
the file.  Since there have been reports I propose backpatching this all the
way down to 13 while at it.

--
Daniel Gustafsson

---

From: Fujii Masao <[email-masked]>
Date: Fri, 11 Jul 2025 08:36:38 +0900

On 2025/07/11 7:22, Daniel Gustafsson wrote:
> the file.

Thanks for updating the patch! LGTM.

Just one small comment:

This row is inserted using the following INSERT statement:

     INSERT INTO weather (date, city, temp_hi, temp_lo)
         VALUES ('1994-11-29', 'Hayward', 54, 37);

Since the prcp column isn't specified, its value is NULL. So shouldn't
the fourth field in the data line above be \N instead of 0.0?

>  Since there have been reports I propose backpatching this all the

+1

Regards,

---

From: Daniel Gustafsson <[email-masked]>
Date: Sat, 12 Jul 2025 00:18:18 +0200

> On 11 Jul 2025, at 01:36, Fujii Masao <[email-masked]> wrote:

> the fourth field in the data line above be \N instead of 0.0?

It should, fixed in v3.

--
Daniel Gustafsson

---

From: Fujii Masao <[email-masked]>
Date: Sat, 12 Jul 2025 12:05:17 +0900

>> the fourth field in the data line above be \N instead of 0.0?

LGTM. Thanks!

Regards,

---

From: Tom Lane <[email-masked]>
Date: Sat, 12 Jul 2025 12:22:45 -0400

> LGTM. Thanks!

I'm okay with this too.  I find myself niggling a bit at the
parenthetical remark "the white space on each line is actually a tab
character".  There's several tabs on each line, so use of the singular
isn't quite right.  However, the best alternative phrasing I could
come up with is "each instance of white space is actually a single tab
character", and that doesn't seem any more understandable.  So maybe
it's best left as you have it.

			regards, tom lane

---

From: Daniel Gustafsson <[email-masked]>
Date: Sat, 12 Jul 2025 18:28:12 +0200

> On 12 Jul 2025, at 18:23, Tom Lane <[email-masked]> wrote:
> 

Or perhaps ”values are separated by a tab character”?

./daniel

---

From: Tom Lane <[email-masked]>
Date: Sat, 12 Jul 2025 12:41:48 -0400

> Or perhaps ”values are separated by a tab character”?

WFM

			regards, tom lane

---

From: Daniel Gustafsson <[email-masked]>
Date: Sat, 12 Jul 2025 21:13:56 +0200

> On 12 Jul 2025, at 18:41, Tom Lane <[email-masked]> wrote:
> 

Thanks, I'll get this pushed once the freeze is over on REL_18_STABLE.

--
Daniel Gustafsson