Received: from malur.postgresql.org ([217.196.149.56]) by arkaria.postgresql.org with esmtps (TLS1.3) tls TLS_ECDHE_RSA_WITH_AES_256_GCM_SHA384 (Exim 4.94.2) (envelope-from ) id 1uZzfd-00CWIb-9n for pgsql-docs@arkaria.postgresql.org; Thu, 10 Jul 2025 22:23:13 +0000 Received: from localhost ([127.0.0.1] helo=malur.postgresql.org) by malur.postgresql.org with esmtp (Exim 4.94.2) (envelope-from ) id 1uZzfZ-0003Q7-UO for pgsql-docs@arkaria.postgresql.org; Thu, 10 Jul 2025 22:23:10 +0000 Received: from magus.postgresql.org ([2a02:c0:301:0:ffff::29]) by malur.postgresql.org with esmtps (TLS1.3) tls TLS_ECDHE_RSA_WITH_AES_256_GCM_SHA384 (Exim 4.94.2) (envelope-from ) id 1uZzfZ-0003Oe-Ic for pgsql-docs@lists.postgresql.org; Thu, 10 Jul 2025 22:23:10 +0000 Received: from smtp.outgoing.loopia.se ([93.188.3.37]) by magus.postgresql.org with esmtps (TLS1.3) tls TLS_ECDHE_RSA_WITH_AES_256_GCM_SHA384 (Exim 4.96) (envelope-from ) id 1uZzfX-006uuj-2Q for pgsql-docs@lists.postgresql.org; Thu, 10 Jul 2025 22:23:09 +0000 Received: from s807.loopia.se (localhost [127.0.0.1]) by s807.loopia.se (Postfix) with ESMTP id BAD5D3E83DB for ; Fri, 11 Jul 2025 00:23:06 +0200 (CEST) Received: from s899.loopia.se (unknown [172.22.191.6]) by s807.loopia.se (Postfix) with ESMTP id A19CE3E8C6D; Fri, 11 Jul 2025 00:23:06 +0200 (CEST) Received: from s472.loopia.se (unknown [172.22.191.5]) by s899.loopia.se (Postfix) with ESMTP id 9E0642C8BA88; Fri, 11 Jul 2025 00:23:06 +0200 (CEST) X-Virus-Scanned: amavisd-new at amavis.loopia.se X-Spam-Flag: NO X-Spam-Score: -1.2 X-Spam-Level: X-Spam-Status: No, score=-1.2 tagged_above=-999 required=6.2 tests=[ALL_TRUSTED=-1, DKIM_SIGNED=0.1, DKIM_VALID=-0.1, DKIM_VALID_AU=-0.1, DKIM_VALID_EF=-0.1] autolearn=disabled Authentication-Results: s472.loopia.se (amavisd-new); dkim=pass (2048-bit key) header.d=yesql.se Received: from s981.loopia.se ([172.22.191.5]) by s472.loopia.se (s472.loopia.se [172.22.190.12]) (amavisd-new, port 10024) with LMTP id PcInDHpEf9rE; Fri, 11 Jul 2025 00:23:06 +0200 (CEST) X-Loopia-Auth: user X-Loopia-User: daniel@yesql.se X-Loopia-Originating-IP: IPv6:2001:2043:5ad6:9500:2dbf:5537:ece6:1f9c Received: from smtpclient.apple (unknown [IPv6:2001:2043:5ad6:9500:2dbf:5537:ece6:1f9c]) (Authenticated sender: daniel@yesql.se) by s981.loopia.se (Postfix) with ESMTPSA id CD63022B165A; Fri, 11 Jul 2025 00:23:05 +0200 (CEST) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=yesql.se; s=loopiadkim1707475645; t=1752186185; bh=FC8MEp3nN7jSATQUWDI6EPaNAAJH5oQHh/9qv/DECE8=; h=From:Subject:Date:In-Reply-To:Cc:To:References; b=mX0loKttewwJVVDPH/m7XEoXec4lgmSKYN3wrWJQIUArHS6kWBvoWaYheaDSIYT/H pebzBkrINqEVSyufPoX3Q8F8VsfDz5X4dEL45yy4BKGWJelE+SENVJYV15SVsV1Kt4 S8u9JpRNrhtPn/e7CSa3vI4kS35+gM1YqAe626/qFlHFA3YjnRh9cn/L0b9CYWdjWy YQbtt7elpxZSCWa8rasCE9nJwastYdVTimjiAqZkpbdeybAiOdr/901bsB/UXRESGC YEHmgX35uJAofzQBodw142In68m44Zd1pA3p8psFVt9fiCDwEYEkriqL6+UzeN7Xa9 2yrbDVbDiXKgA== From: Daniel Gustafsson Message-Id: <4DF3BEAF-EAAA-4C91-92B3-2CA8F022B383@yesql.se> Content-Type: multipart/mixed; boundary="Apple-Mail=_1B71030B-93C5-4B1C-8CF1-3007B291017E" Mime-Version: 1.0 (Mac OS X Mail 16.0 \(3776.700.51.11.2\)) Subject: Re: Missing File weather.txt Date: Fri, 11 Jul 2025 00:22:55 +0200 In-Reply-To: <10240.1751736559@sss.pgh.pa.us> Cc: Fujii Masao , davidhowes@gmail.com, pgsql-docs@lists.postgresql.org To: Tom Lane References: <158017814191.19852.15019251381150731439@wrigleys.postgresql.org> <68FE7D96-3F05-40E3-B3A2-04CE267CF28A@yesql.se> <89bd784e-c3ab-4d9e-9be1-0846bd8c260c@oss.nttdata.com> <10240.1751736559@sss.pgh.pa.us> X-Mailer: Apple Mail (2.3776.700.51.11.2) List-Id: List-Help: List-Subscribe: List-Post: List-Owner: List-Archive: Archived-At: Precedence: bulk --Apple-Mail=_1B71030B-93C5-4B1C-8CF1-3007B291017E Content-Transfer-Encoding: quoted-printable Content-Type: text/plain; charset=us-ascii > On 5 Jul 2025, at 19:29, Tom Lane wrote: >=20 > 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. >=20 >> 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. >=20 > +1 >=20 >> In the tutorial, three rows are inserted using INSERT, so shouldn't >> the sample input for COPY include all three, like this? >=20 > 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:". 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 --Apple-Mail=_1B71030B-93C5-4B1C-8CF1-3007B291017E Content-Disposition: attachment; filename=v2-0001-doc-Add-example-file-for-COPY.patch Content-Type: application/octet-stream; x-unix-mode=0644; name="v2-0001-doc-Add-example-file-for-COPY.patch" Content-Transfer-Encoding: quoted-printable =46rom=205d45c8cd7fefab10670d91d9f541001b4631d1a0=20Mon=20Sep=2017=20= 00:00:00=202001=0AFrom:=20Daniel=20Gustafsson=20= =0ADate:=20Fri,=2011=20Jul=202025=2000:03:57=20= +0200=0ASubject:=20[PATCH=20v2]=20doc:=20Add=20example=20file=20for=20= COPY=0A=0AThe=20paragraph=20for=20introducing=20INSERT=20and=20COPY=20= discussed=20how=20a=20file=0Acould=20be=20used=20for=20bulk=20loading=20= with=20COPY,=20without=20actually=20showing=0Awhat=20the=20file=20would=20= look=20like.=20=20This=20adds=20a=20programlisting=20for=20the=0Afile=20= contents.=0A=0ABackpatch=20to=20all=20supported=20branches=20since=20= this=20example=20has=20lacked=0Athe=20file=20contents=20since=20= PostgreSQL=207.2.=0A=0AAuthor:=20Daniel=20Gustafsson=20=0A= Reported-by:=20davidhowes@gmail.com=0ADiscussion:=20= https://postgr.es/m/158017814191.19852.15019251381150731439@wrigleys.postg= resql.org=0ABackpatch-through:=2013=0A---=0A=20doc/src/sgml/query.sgml=20= |=2014=20++++++++++++--=0A=201=20file=20changed,=2012=20insertions(+),=20= 2=20deletions(-)=0A=0Adiff=20--git=20a/doc/src/sgml/query.sgml=20= b/doc/src/sgml/query.sgml=0Aindex=20727a0cb185f..b1770bb782d=20100644=0A= ---=20a/doc/src/sgml/query.sgml=0A+++=20b/doc/src/sgml/query.sgml=0A@@=20= -264,8=20+264,18=20@@=20COPY=20weather=20FROM=20= '/home/user/weather.txt';=0A=20=0A=20=20=20=20=20where=20the=20file=20= name=20for=20the=20source=20file=20must=20be=20available=20on=20the=0A=20= =20=20=20=20machine=20running=20the=20backend=20process,=20not=20the=20= client,=20since=20the=20backend=20process=0A-=20=20=20=20reads=20the=20= file=20directly.=20=20You=20can=20read=20more=20about=20the=0A-=20=20=20=20= COPY=20command=20in=20.=0A= +=20=20=20=20reads=20the=20file=20directly.=20=20The=20data=20inserted=20= above=20into=20the=20weather=20table=0A+=20=20=20=20could=20also=20be=20= inserted=20from=20a=20file=20containing=20(note=20that=20the=20white=20= space=0A+=20=20=20=20on=20each=20line=20is=20actually=20a=20tab=20= character):=0A+=0A+=0A+San=20Francisco=20=20=20=2046=20=20= =20=2050=20=20=20=200.25=20=20=20=201994-11-27=0A+San=20Francisco=20=20=20= =2043=20=20=20=2057=20=20=20=200.0=20=20=20=201994-11-29=0A+Hayward=20=20= =20=2037=20=20=20=2054=20=20=20=200.0=20=20=20=201994-11-29=0A= +=0A+=0A+=20=20=20=20You=20can=20read=20more=20about=20= the=20COPY=20command=20in=0A+=20=20=20=20.=0A=20=20=20=20=0A=20=20=20=0A=20=0A= --=20=0A2.39.3=20(Apple=20Git-146)=0A=0A= --Apple-Mail=_1B71030B-93C5-4B1C-8CF1-3007B291017E--