[HACKERS] Re: new set of psql patches for loading (saving) data from (to) text,binary files - Mailing list pgsql-hackers

Hi


> > There's a whitespace-only hunk that shouldn't be included.
> >
> > I don't agree with the single-column/single-row restriction on these.  I
> > can certainly see a case where someone might want to, say, dump out a
> > bunch of binary integers into a file for later processing.
> >
> > The tab-completion for 'gstore' wasn't correct (you didn't include the
> > double-backslash).  The patch also has conflicts against current master
> > now.
> >
> > I guess my thinking about moving this forward would be to simplify it to
> > just '\gb' which will pull the data from the server side in binary
> > format and dump it out to the filename or command given.  If there's a
> > new patch with those changes, I'll try to find time to look at it.
>
> ok I'll prepare patch

Great, thanks!

I rewrote these patches - it allows binary export/import from psql and the code is very simple. The size of the patch is bigger due including 4KB binary file (in hex format 8KB).

What is done:

create table foo foo(a bytea);

-- import
insert into foo values($1)
\gloadfrom ~/xxx.jpg bytea

-- export
\pset format binary
select a from foo
\g ~/xxx2.jpg

tested on import 55MB binary file

Comments, notes?

Available import formats are limited to text, bytea, xml - these formats are safe for receiving data via recv function.

Regards

Pavel

 

Stephen

Attachment

pgsql-hackers by date:

Previous
From: Tom Lane
Date:
Subject: Re: [HACKERS] New CORRESPONDING clause design
Next
From: Robert Haas
Date:
Subject: Re: [HACKERS] background sessions