Subject: end of COPY

From: Marc Millas <[email-masked]>
Date: Wed, 5 Mar 2025 16:22:30 +0100

Hi,
on a Postgres 16 DB running on a redhat 8.5 x86 machineI want to input some
data using copy from stdin
so.. more that 700 000 lines goes well.
Then the flow contains a single line: \.
to my understanding this means end of the copy

but, Postgres generates an error :
invalid input syntax for type numeric "\."
then the 2 lines stating the copy command that was executed.

what am I missing ?

thanks

Marc MILLAS
Senior Architect
+33607850334
www.mokadb.com

---

From: Ron Johnson <[email-masked]>
Date: Wed, 5 Mar 2025 10:40:33 -0500

On Wed, Mar 5, 2025 at 10:22 AM Marc Millas <[email-masked]> wrote:

> Hi,
> on a Postgres 16 DB running on a redhat 8.5 x86 machineI want to input
> some data using copy from stdin

I just tested this on PG 16.8.  No backslash.
$ psql TAP -Xc "copy public.job_notification TO STDOUT;"

https://www.postgresql.org/docs/16/sql-copy.html
"End of data *can be* represented by a single line containing just
backslash-period (\.)."
"the end-of-data marker (\.) or the null string (\N by default)."

> then the 2 lines stating the copy command that was executed.

COPY is expecting something after the backslash.

-- 
Death to <Redacted>, and butter sauce.
Don't boil me, I'm still alive.
<Redacted> lobster!

---

From: Greg Sabino Mullane <[email-masked]>
Date: Wed, 5 Mar 2025 10:52:24 -0500

On Wed, Mar 5, 2025 at 10:22 AM Marc Millas <[email-masked]> wrote:

> Then the flow contains a single line: \. to my understanding this means
> end of the copy
>
> but, Postgres generates an error : invalid input syntax for type numeric
> "\."
>

This can happen when you send TWO backslashes and a dot, rather than a
single backslash and a dot.

Cheers,
Greg

--
Crunchy Data - https://www.crunchydata.com
Enterprise Postgres Software Products & Tech Support

---

From: Adrian Klaver <[email-masked]>
Date: Wed, 5 Mar 2025 07:55:03 -0800

> to my understanding this means end of the copy

Provide the lines at the end of the data.

> then the 2 lines stating the copy command that was executed.

Provide the complete error message.

> 
> what am I missing ?
> 
> thanks
> 
> 
> Marc MILLAS
> Senior Architect
> +33607850334
> www.mokadb.com <http://www.mokadb.com>
> 

-- 
Adrian Klaver
[email-masked]

---

From: Ron Johnson <[email-masked]>
Date: Wed, 5 Mar 2025 10:59:44 -0500

> single backslash and a dot.

I hate proportional fonts. 😠