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é <[EMAIL PROTECTED]> 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


---------------------------(end of broadcast)---------------------------
TIP 4: Have you searched our list archives?

              http://archives.postgresql.org/

Reply via email to