Re: pg_dump without blobs - Mailing list pgsql-general

From Sébastien Boutté
Subject Re: pg_dump without blobs
Date
Msg-id 60e9579c0707200325p69019e13o694743df1a676276@mail.gmail.com
Whole thread Raw
In response to pg_dump without blobs  ("Sébastien Boutté" <sebastien.boutte@gmail.com>)
List 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.boutte@gmail.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
>

pgsql-general by date:

Previous
From: Zlatko Matić
Date:
Subject: privillages for pg_class
Next
From: Tom Allison
Date:
Subject: Re: CASE in ORDER BY clause