AW: BUG #16300: Text line order corruption with COPY command

From: Hans Buschmann <buschmann(at)nidsa(dot)net>
To: "David G(dot) Johnston" <david(dot)g(dot)johnston(at)gmail(dot)com>, PostgreSQL mailing lists <pgsql-bugs(at)lists(dot)postgresql(dot)org>
Subject: AW: BUG #16300: Text line order corruption with COPY command
Date: 2020-03-13 08:49:50
Message-ID: 1584089392834.36289@nidsa.net
Views: Raw Message | Whole Thread | Download mbox | Resend email
Thread:
Lists: pgsql-bugs

________________________________
Von: David G. Johnston <david(dot)g(dot)johnston(at)gmail(dot)com>
Gesendet: Donnerstag, 12. März 2020 21:42
An: Hans Buschmann; PostgreSQL mailing lists
Betreff: Re: BUG #16300: Text line order corruption with COPY command

Thank you for the quick reply.

When looking into the documentation I find under SQL COPY command:

"If a column list is specified, COPY TO copies only the data in the specified columns to the file.
For COPY FROM, each field in the file is inserted, in order, into the specified column.
Table columns not specified in the COPY FROM column list will receive their default values. "

So I expected the insertion in order as said above.

In my opinion it is essential to preserve the order of textfile input in COPY FROM. This also holds true when copying from another source like a program, where often it is not practicable to add an orderable column on input.

Not preserving (and rendering on a select) the order makes the COPY FROM mostly unusable for cases where the order must be preserved. (Think of XML, JSON, Source code, Log files, Disassembly etc.).

The size of such kind of files can it make also impractible to take the mentioned circumventing methods you provided.

I have not inspected the resulting tuple orders on the physical file.

I will try to nail down the first occurence of the disordering during the import by comparing import and export.

My concern also goes to pg_dump and friends, which could change such not natural orderable tables through pg_dump/pg_restore.

Hans Buschmann

In response to

Responses

Browse pgsql-bugs by date

  From Date Subject
Next Message Francisco Olarte 2020-03-13 09:26:16 Re: BUG #16300: Text line order corruption with COPY command
Previous Message David G. Johnston 2020-03-12 20:42:58 Re: BUG #16300: Text line order corruption with COPY command