pg_dump, formats & blobs - Mailing list pgsql-hackers

From Mathijs Brands
Subject pg_dump, formats & blobs
Date
Msg-id 20010414011407.A99638@ilse.nl
Whole thread Raw
Responses Re: pg_dump, formats & blobs
List pgsql-hackers
Hi

I've been experimenting with 7.1rc4 for a couple of hours. I was messing with
blobs, and the new toast setup worked quite nicely. One thing I especially
liked was the fact that by having pg_dump create a dumpfile in the custom or
tar format, I could also backup all blobs in one go.

Unfortunately, practice was a bit different. Which is why I would like to know
if these functions are intended for general use.

A small log:

sol2:~$ uname -srm
SunOS 5.8 sun4u
sol2:~$ createdb blaat
CREATE DATABASE
sol2:~$ psql -c 'create table test(a oid)' blaat
CREATE
sol2:~$ psql -c "insert into test values(lo_import('/etc/hosts'))" blaat 
INSERT 18761 1
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
;     dbname: blaat
;     TOC Entries: 4
;     Compression: -1
;     Dump Version: 1.5-2
;     Format: CUSTOM
;
;
; Selected TOC Entries:
;
2; 18749 TABLE test mathijs
3; 18749 TABLE DATA test mathijs
4; 0 BLOBS BLOBS 
sol2:~$ grep serv /etc/hosts
10.1.8.12       serv2.ilse.nl
10.1.8.10       serv0.ilse.nl
sol2:~$ grep serv blaat.bk  
sol2:~$ pg_dump -b -Ft -f blaat.tar blaat
zsh: segmentation fault (core dumped)  pg_dump -b -Ft -f blaat.tar blaat
sol2:~$ psql -c 'select version()' blaat                             version                              
-------------------------------------------------------------------PostgreSQL 7.1rc4 on sparc-sun-solaris2.8, compiled
byGCC 2.95.3
 
(1 row)

A backtrace reveals the following:
#0  0xff132e5c in strlen () from /usr/lib/libc.so.1
#1  0xff181890 in _doprnt () from /usr/lib/libc.so.1
#2  0xff183a04 in vsnprintf () from /usr/lib/libc.so.1
#3  0x2710c in ahprintf (AH=0x56cd0, fmt=0x430a8 "-- File: %s\n")   at pg_backup_archiver.c:1116
#4  0x2ee90 in _PrintExtraToc (AH=0x56cd0, te=0x5e838) at pg_backup_tar.c:305
#5  0x290e0 in _printTocEntry (AH=0x56cd0, te=0x5e838, ropt=0x681b0)   at pg_backup_archiver.c:1877
#6  0x25470 in RestoreArchive (AHX=0x56cd0, ropt=0x681b0)   at pg_backup_archiver.c:269
#7  0x2ffb8 in _CloseArchive (AH=0x56cd0) at pg_backup_tar.c:840
#8  0x24f68 in CloseArchive (AHX=0x56cd0) at pg_backup_archiver.c:136
#9  0x15128 in main (argc=6, argv=0xffbefcac) at pg_dump.c:1114

What happens is that in line 305 of pg_backup_tar.c, ahprintf is handed a NULL
pointer.

300   static void
301   _PrintExtraToc(ArchiveHandle *AH, TocEntry *te)
302   {
303           lclTocEntry *ctx = (lclTocEntry *) te->formatData;
304   
305           ahprintf(AH, "-- File: %s\n", ctx->filename);
306   }

Could this be caused by the fact that IMHO blobs aren't dumped correctly?

Regards,

Mathijs
--
It's not that perl programmers are idiots, it's that the language
rewards idiotic behavior in a way that no other language or tool has
ever done.                                                   Erik Naggum


pgsql-hackers by date:

Previous
From: Matthew Rice
Date:
Subject: Re: Anyone have any good addresses ... ?
Next
From: "Len Morgan"
Date:
Subject: Re: RPM upgrade caveats going from a beta version to RC