Re: COPY table_name (single_column) FROM 'unknown.txt' DELIMITER E'\n'

From: Isaac Morland <isaac(dot)morland(at)gmail(dot)com>
To: Joel Jacobson <joel(at)compiler(dot)org>
Cc: Darafei Komяpa Praliaskouski <me(at)komzpa(dot)net>, Tom Lane <tgl(at)sss(dot)pgh(dot)pa(dot)us>, "David G(dot) Johnston" <david(dot)g(dot)johnston(at)gmail(dot)com>, Chapman Flack <chap(at)anastigmatix(dot)net>, PostgreSQL Hackers <pgsql-hackers(at)lists(dot)postgresql(dot)org>
Subject: Re: COPY table_name (single_column) FROM 'unknown.txt' DELIMITER E'\n'
Date: 2021-05-06 16:37:39
Message-ID: CAMsGm5eY+s-80sNz6W7KnwYw=y=P7ci66wt4rgB6LuyoAWNRWw@mail.gmail.com
Views: Raw Message | Whole Thread | Download mbox | Resend email
Thread:
Lists: pgsql-hackers

On Thu, 6 May 2021 at 12:02, Joel Jacobson <joel(at)compiler(dot)org> wrote:

> On Thu, May 6, 2021, at 13:41, Isaac Morland wrote:
>
> Yes! A significant missing feature is “take this arbitrary bucket of bits
> and move it to/from the database from/to this file without modification of
> any kind”. There are all sorts of tutorials on the Web about how to almost
> do it or fake it or convert to hex or whatever but I’ve never seen a nice
> simple explanation of “here is the command:”.
>
> Of course there is a lot to think about. Coming out of the database, the
> query result must be exactly one row containing exactly one column; how do
> we handle other database results? Coming into the database, only one data
> value can come from a single file; so how do we populate the other columns
> of whatever table we copy to?
>
> If the file is on the server, you can use pg_read_binary_file() for that
> purpose.
>

Yes, sorry, I should have explicitly said “on the client” somewhere up
there. Getting files from the DB server into the DB is no problem.

In response to

Browse pgsql-hackers by date

  From Date Subject
Next Message Stephen Frost 2021-05-06 17:12:24 Re: Asynchronous Append on postgres_fdw nodes.
Previous Message 盏一 2021-05-06 16:30:13 use `proc->pgxactoff` as the value of `index` in `ProcArrayRemove()`