From: Rob Sargent <robjsargent@gmail.com>
To: Вадим Самохин <samokhinvadim@gmail.com>
Cc: pgsql-general@lists.postgresql.org
Subject: Re: copy file from a client app to remote postgres isntance
Date: Mon, 7 Nov 2022 11:05:07 -0700
Message-ID: <8faa81f6-cce4-f009-c035-d8e0e15e4760@gmail.com> (raw)
In-Reply-To: <CAGVmuwrtW+jo_EHbVgfoT84cW4ShajtnMgApzv0uYT-NdFxY0w@mail.gmail.com>
References: <CAGVmuwoKkos2ssA7-MNpsQkxO=0ouOGS9PtqzFViJ2+0SDeXkQ@mail.gmail.com>
<ad628547-cfd3-20b8-689a-08b869c5b195@gmail.com>
<CAGVmuwrtW+jo_EHbVgfoT84cW4ShajtnMgApzv0uYT-NdFxY0w@mail.gmail.com>
On 11/7/22 10:51, Вадим Самохин wrote:
> Well, actually, just ordinary 3 tier architecture. Simple UI connected
> via restful API with backend written in php, which copies some data in
> a remote database, that's pretty much it.
>
> пн, 7 нояб. 2022 г. в 20:30, Rob Sargent <robjsargent@gmail.com>:
>
> On 11/7/22 09:57, Вадим Самохин wrote:
>> Hi all,
>> I have an application that must copy a local file in csv format
>> to a postgres table on a remote host. The closest solution is
>> this one (https://stackoverflow.com/a/9327519/618020
>> <http://stackoverflow.com/a/9327519/618020;). It boils down to
>> specifying a \copy meta-command in a psql command:
>> |psql -U %s -p %s -d %s -f - <<EOT\n here hoes a \copy
>> meta-command \nEOT\n ||and executing it. B|ut it's quite an unnatural way to write
>> database code. Has anything changed in the last ten years? Or, is
>> there a better wayto copy file contents in a remote database?
> There are bulk copy routines available. What is your architecture?
>
We generally "bottom post" in this group.
Most things I find on the web suggest send the csv file to server and
run COPY there. Some show iterating over the csv, but critical to get
csv off the client.
Reply instructions:
You may reply publicly to this message via plain-text email
using any one of the following methods:
* Reply to all the recipients from your mail client; the link fills in
the headers below: reply via email
Some clients, webmail especially, drop In-Reply-To and References from
a link, and the reply then starts a new thread: use the mbox below.
To: pgsql-general@postgresql.org
Cc: robjsargent@gmail.com, samokhinvadim@gmail.com
Subject: Re: copy file from a client app to remote postgres isntance
In-Reply-To: <8faa81f6-cce4-f009-c035-d8e0e15e4760@gmail.com>
References: <CAGVmuwoKkos2ssA7-MNpsQkxO=0ouOGS9PtqzFViJ2+0SDeXkQ@mail.gmail.com> <ad628547-cfd3-20b8-689a-08b869c5b195@gmail.com> <CAGVmuwrtW+jo_EHbVgfoT84cW4ShajtnMgApzv0uYT-NdFxY0w@mail.gmail.com> <8faa81f6-cce4-f009-c035-d8e0e15e4760@gmail.com>
* Save the following mbox file, import it into your mail client,
and reply-to-all from there: mbox
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