Re: pg_dump, formats & blobs

From: Mathijs Brands <mathijs(at)ilse(dot)nl>
To: Philip Warner <pjw(at)rhyme(dot)com(dot)au>
Cc: pgsql-hackers(at)postgresql(dot)org
Subject: Re: pg_dump, formats & blobs
Date: 2001-04-14 02:10:26
Message-ID: 20010414041026.A36393@ilse.nl
Views: Raw Message | Whole Thread | Download mbox | Resend email
Thread:
Lists: pgsql-hackers

On Sat, Apr 14, 2001 at 11:44:18AM +1000, Philip Warner allegedly wrote:
> At 01:14 14/04/01 +0200, Mathijs Brands wrote:
> ...
> >sol2:~$ pg_dump -b -Fc -f blaat.bk blaat
> >sol2:~$ pg_restore -l blaat.bk
> ...
> >;
> >; Archive created at Sat Apr 14 01:03:02 2001
> ...
>
> This all looks fine.

Hmm, I can only agree.

sol2:~$ cksum postgresql-7.1rc4.tar.gz
61540329 8088934 postgresql-7.1rc4.tar.gz
sol2:~$ dropdb blaat
DROP DATABASE
sol2:~$ createdb blaat
CREATE DATABASE
sol2:~$ psql -c 'create table test(a oid)' blaat
CREATE
sol2:~$ psql -c "insert into test values(lo_import('/export/home/mathijs/postgresql-7.1rc4.tar.gz'))" blaat
INSERT 22753 1
sol2:~$ pg_dump -b -Fc -f blaat.bk blaat
sol2:~$ psql -c 'drop table test ; vacuum' blaat
VACUUM
sol2:~$ pg_restore -d blaat blaat.bk
sol2:~$ psql -c "select lo_export(test.a, '/export/home/mathijs/testfile') from test" blaat
lo_export
-----------
1
(1 row)

sol2:~$ cksum testfile
61540329 8088934 testfile
sol2:~$ pg_restore -l blaat.bk
;
; Archive created at Sat Apr 14 03:59:02 2001
; dbname: blaat
; TOC Entries: 4
; Compression: -1
; Dump Version: 1.5-2
; Format: CUSTOM
;
;
; Selected TOC Entries:
;
2; 18792 TABLE test mathijs
3; 18792 TABLE DATA test mathijs
4; 0 BLOBS BLOBS

I couldn't get blobs to be restored correctly (must've been doing
something wrong). When something doesn't work, never question your
own methods ;)

> >sol2:~$ pg_dump -b -Ft -f blaat.tar blaat
> >zsh: segmentation fault (core dumped) pg_dump -b -Ft -f blaat.tar blaat
>
> This is less good. It's caused by the final part of TAR output, which also
> dumps a plain SQL script for reference (not actually ever used by
> pg_restore). I will fix this in CVS; ctx->filename is set to null for this
> script, and my compiler outputs '(null)', which is very forgiving of it.

It's more likely that your C library is more forgiving (ie. Open Source OS?).

> >Could this be caused by the fact that IMHO blobs aren't dumped correctly?
> >
>
> Is there some other problem with BLOBs that you did not mention? AFAICT,
> this is only a problem with TAR output (an will be fixed ASAP).

Yeah, they're not fool proof ;)

Sorry about the false alarm. I was convinced restoring blobs
didn't work correctly.

Regards,

Mathijs
--
$_='while(read+STDIN,$_,2048){$a=29;$c=142;if((@a=unx"C*",$_)[20]&48){$h=5;
$_=unxb24,join"",@b=map{xB8,unxb8,chr($_^$a[--$h+84])}(at)ARGV;s/...$/1$&/;$d=
unxV,xb25,$_;$b=73;$e=256|(ord$b[4])<<9|ord$b[3];$d=$d>>8^($f=($t=255)&($d
>>12^$d>>4^$d^$d/8))<<17,$e=$e>>8^($t&($g=($q=$e>>14&7^$e)^$q*8^$q<<6))<<9
,$_=(map{$_%16or$t^=$c^=($m=(11,10,116,100,11,122,20,100)[$_/16%8])&110;$t
^=(72,@z=(64,72,$a^=12*($_%16-2?0:$m&17)),$b^=$_%64?12:0,@z)[$_%8]}(16..271))
[$_]^(($h>>=8)+=$f+(~$g&$t))for(at)a[128(dot)(dot)$#a]}print+x"C*",@a}';s/x/pack+/g;eval

In response to

Responses

Browse pgsql-hackers by date

  From Date Subject
Next Message Lamar Owen 2001-04-14 02:11:26 Re: Re: 7.1 RPMs
Previous Message Peter Eisentraut 2001-04-14 01:48:38 Re: Re: Tag'd, packaged and ready to go ...