Re: insert binary data into a table column with psql - Mailing list pgsql-general

From Tom Lane
Subject Re: insert binary data into a table column with psql
Date
Msg-id 9883.1343182616@sss.pgh.pa.us
Whole thread Raw
In response to Re: insert binary data into a table column with psql  (jtkells <jtkells@verizon.net>)
Responses Re: insert binary data into a table column with psql  (Lonni J Friedman <netllama@gmail.com>)
List pgsql-general
jtkells <jtkells@verizon.net> writes:
> Thanks much for your reply, that does the trick quite nicely. But, I just
> came to the realization that this only works if your are running the
> client and the file both resides  on the database server.  I thought that
> I would be able to do this from a remote server where the client was
> running, picking up a local file and sending it into a remote database
> table.  Unless I am missing something, I cant. I can create a temp table
> on this server, upload the file to a similar table then replicate it to
> the targeted server..  Lots of work that could be easily done with a
> programming language (as someone else posted) but thats what I have to
> work with for now and I have no direct access (I.e. sftp ) to the
> database server

Maybe use psql's \lo_import command to suck the data into a "large
object" on the server, and then use loread() to insert it into the
target table?  (And don't forget to drop the large object after.)
Pretty grotty but I think it might be the only solution with the
currently available tools.

btw, does "bytea_import" actually exist?  It's not in the core
server for sure.

            regards, tom lane

pgsql-general by date:

Previous
From: Tom Lane
Date:
Subject: Re: Smaller data types use same disk space
Next
From: Lonni J Friedman
Date:
Subject: Re: insert binary data into a table column with psql