From: | Sébastien Boutté <sebastien(dot)boutte(at)gmail(dot)com> |
---|---|
To: | pgsql-general(at)postgresql(dot)org |
Subject: | Re: pg_dump without blobs |
Date: | 2007-07-20 10:25:35 |
Message-ID: | 60e9579c0707200325p69019e13o694743df1a676276@mail.gmail.com |
Views: | Raw Message | Whole Thread | Download mbox | Resend email |
Thread: | |
Lists: | pgsql-general |
I think i've found a solution, i will do this :
CREATE FUNCTION save_bytea_on_system(bytea) RETURNS varchar AS $$
use File::Temp ();
$fh = new File::Temp();
binmode($fh);
my $data = $_[0];
$data =~ s{\\(\\|[0-7]{3})}{$1 eq "\\" ? $1 : chr(oct($1))}ge;
$fname = $fh->filename;
syswrite $fh,$data;
close $fh;
return $fname;
$$ LANGUAGE plperlu;
update my_table set new_field = lo_import(save_bytea_on_system(old_field));
I think that postgres team should add a method for doing these
conversion much simplier.
Sebastien
On 7/15/07, Sébastien Boutté <sebastien(dot)boutte(at)gmail(dot)com> wrote:
> Hi,
>
> I have a postgressql database with a table containing a bytea field. I
> would like to dump without this particulary field in order to improve
> dump and restore time.
> I try with options : -n public (without -b) but it's always the same,
> the dump is huge.
>
> How can i do that ?
> Do i have to convert my field bytea to oid ?
>
> Thank you for your help,
>
> Sebastien
>
From | Date | Subject | |
---|---|---|---|
Next Message | Tom Allison | 2007-07-20 11:25:51 | Re: CASE in ORDER BY clause |
Previous Message | Zlatko Matić | 2007-07-20 09:29:34 | privillages for pg_class |