Tuesday, February 14. 2012PSQL needs a better way of outputting bytea to binary filesPrinter FriendlyComments
Display comments as
(Linear | Threaded)
I think usually when you are at this stage, it's best to reconsider your tools. I like psql very much, but at that point I would strongly look at Perl (or Python or GUIs or ...).
Tim,
I don't think that psql is that far off from being able to do this. True you can use other tools, but as a developer of PostreSQL specific contribs (PostGIS in this case), I like to have a solution readily available that I know all my end-users can run without requiring extra installation. psql fits the bill nicely for that.
I think we need a new psql command. Something like:
\copybin (select query returning some bytea) to /path/to/file It shouldn't be terribly hard to do.
Andrew,
I LOVE that idea. Any chance of seeing something like that in 9.2?
Love the idea, too, but the 9.2 window is probably closed. Interestingly, it's now (git head) possible to use \0 as a separator, which might help in some cases.
At worst, the 9.3 window opens pretty soon :)
Wonder if that means we'll have to start talking about 9.3 in the PostgreSQL book we are writing. Hopefully we'll have it out before or around 9.2 hits the proverbial shelves :)
You might want to have a look at SQL Workbench/J which can easily write BLOBs (that are part of a query result) into a local file on the client. Either for all rows or for a specific row and this can be used as a console application or in batch mode: http://www.sql-workbench.net/blob_example.html
|
Entry's LinksQuicksearchCalendar
Categories
Blog Administration |
Tracked: Feb 17, 18:07