Re: insert binary data into a table column with psql

From: Thomas Kellerer <spam_eater(at)gmx(dot)net>
To: pgsql-general(at)postgresql(dot)org
Subject: Re: insert binary data into a table column with psql
Date: 2012-07-25 07:12:43
Message-ID: juo69g$auo$1@dough.gmane.org
Views: Raw Message | Whole Thread | Download mbox | Resend email
Thread:
Lists: pgsql-general

jtkells, 25.07.2012 03:43:
> 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.

If you can use a different client, you might want to look at SQL Workbench/J

It has support to do just that. You can write e.g.

insert into x (id, load_date, image)
values
(1, current_date, {$blobfile=/tmp/myimage.jpg});

and the file will be read from the client (where SQL Workbench is running).
(note that "large objects" are _not_ supported, only bytea)

http://www.sql-workbench.net/
http://www.sql-workbench.net/manual/using.html#blob-support

It's Java/JDBC based, has a GUI and console mode.

Disclaimer: I am the author of that tool.

Regards
Thomas

In response to

Browse pgsql-general by date

  From Date Subject
Next Message Marcin Mańk 2012-07-25 07:41:58 Re: Odd corruption issue reported on dba.stackexchange.com, need advice
Previous Message Jeff Davis 2012-07-25 04:49:14 Mutable tables