pg.ddx.io  pgsql-bugs@postgresql.org mailing list archive  
help / color / mirror / Atom feed
about psql copy ,we would like to seek help,Thanks.
4+ messages / 4 participants
[nested] [flat]

* about psql copy ,we would like to seek help,Thanks.
@ 2023-12-14 01:04  高升 <13325718563@189.cn>
  0 siblings, 2 replies; 4+ messages in thread

From: 高升 @ 2023-12-14 01:04 UTC (permalink / raw)
  To: pgsql-bugs@lists.postgresql.org

PSQL engineers, hello: 

We encountered a problem during the process of importing data from a text
file to the PG database using psql's COPY command, and we would like to seek
help. The issue is that if there are any exceptional records in the file,
the program exits, but we want to skip those erroneous records and continue
with the rest of the import. 

We have looked at some tutorials, and it seems that we can use the
"CONTINUE" option. By using the CONTINUE option, the COPY command should
ignore error rows and continue with the copying operation until all rows are
copied. The relevant error information for the error rows will be recorded. 

COPY table_name FROM '/path/to/data/file.csv' (FORMAT csv, DELIMITER ',',
NULL '', CONTINUE); 

However, when we actually tried this, an error occurred, and it seems that
the parameter is not recognized.

ERROR: option "continue" not recognized 

 

My psql version : psql (PostgreSQL) 12.7

 

 

 

Could this be due to the version? Are there any other ways to handle this?
Thank you for your support.

 

Best Regards.

Gaosheng 

2023-12-14 from China

^ permalink  raw  reply  [nested|flat] 4+ messages in thread

* Re: about psql copy ,we would like to seek help,Thanks.
@ 2023-12-14 01:26  David G. Johnston <david.g.johnston@gmail.com>
  parent: 高升 <13325718563@189.cn>
  1 sibling, 0 replies; 4+ messages in thread

From: David G. Johnston @ 2023-12-14 01:26 UTC (permalink / raw)
  To: 高升 <13325718563@189.cn>; +Cc: pgsql-bugs@lists.postgresql.org

On Wed, Dec 13, 2023 at 6:22 PM 高升 <13325718563@189.cn> wrote:

> PSQL engineers, hello:
>

The project is PostgreSQL, psql is a command line program included within
the distribution.

We encountered a problem during the process of importing data from a text
> file to the PG database using psql's COPY command, and we would like to
> seek help. The issue is that if there are any exceptional records in the
> file, the program exits, but we want to skip those erroneous records and
> continue with the rest of the import.
>
> We have looked at some tutorials,
>

Then those tutorials are buggy, not PostgreSQL.  Nowhere does our
documentation say that this keyword is valid or that this capability is
present.  There are third-party tools out there that do this kind of
thing.  You will need to use one of them.

David J.

^ permalink  raw  reply  [nested|flat] 4+ messages in thread

* Re: about psql copy ,we would like to seek help,Thanks.
@ 2023-12-14 08:08  hubert depesz lubaczewski <depesz@depesz.com>
  parent: 高升 <13325718563@189.cn>
  1 sibling, 1 reply; 4+ messages in thread

From: hubert depesz lubaczewski @ 2023-12-14 08:08 UTC (permalink / raw)
  To: 高升 <13325718563@189.cn>; +Cc: pgsql-bugs@lists.postgresql.org

On Thu, Dec 14, 2023 at 09:04:55AM +0800, 高升 wrote:
> We have looked at some tutorials, and it seems that we can use the
> "CONTINUE" option. By using the CONTINUE option, the COPY command should
> ignore error rows and continue with the copying operation until all rows are
> copied. The relevant error information for the error rows will be recorded. 

I searched the web using google and duckduckgo, and the phrase "By using
the CONTINUE option, the COPY command should" doesn't exist anywhere.

Which suggests that it wasn't "some tutorial" but rather hallucination
by chatgpt or some other "ai" that provides untruths.

In future, I would suggest to verify the things that these things spew,
as even 5 second glance at copy documentation
https://www.postgresql.org/docs/current/sql-copy.html shows that there
is no such option.

depesz





^ permalink  raw  reply  [nested|flat] 4+ messages in thread

* Re: about psql copy ,we would like to seek help,Thanks.
@ 2023-12-14 08:14  Christophe Pettus <xof@thebuild.com>
  parent: hubert depesz lubaczewski <depesz@depesz.com>
  0 siblings, 0 replies; 4+ messages in thread

From: Christophe Pettus @ 2023-12-14 08:14 UTC (permalink / raw)
  To: depesz@depesz.com; +Cc: 高升 <13325718563@189.cn>; pgsql-bugs@lists.postgresql.org



> On Dec 14, 2023, at 00:08, hubert depesz lubaczewski <depesz@depesz.com> wrote:
> Which suggests that it wasn't "some tutorial" but rather hallucination
> by chatgpt or some other "ai" that provides untruths.

Snowflake (for example) has a CONTINUE option on COPY, so it's possible either the OP pulled up a tutorial for a different database system, or the "author" of the tutorial smashed multiple different systems together.




^ permalink  raw  reply  [nested|flat] 4+ messages in thread


end of thread, other threads:[~2023-12-14 08:14 UTC | newest]

Thread overview: 4+ messages (download: mbox mbox.gz follow: Atom feed)
-- links below jump to the message on this page --
2023-12-14 01:04 about psql copy ,we would like to seek help,Thanks. 高升 <13325718563@189.cn>
2023-12-14 01:26 ` David G. Johnston <david.g.johnston@gmail.com>
2023-12-14 08:08 ` hubert depesz lubaczewski <depesz@depesz.com>
2023-12-14 08:14   ` Christophe Pettus <xof@thebuild.com>

This inbox is served by DDX for PostgreSQL; see mirroring instructions
for how to clone and mirror all data and code used for this inbox