pg_dump, formats & blobs

From: Mathijs Brands <mathijs(at)ilse(dot)nl>
To: pgsql-hackers(at)postgresql(dot)org
Subject: pg_dump, formats & blobs
Date: 2001-04-13 23:14:07
Message-ID: 20010414011407.A99638@ilse.nl
Views: Raw Message | Whole Thread | Download mbox | Resend email
Thread:
Lists: 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 by GCC 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

Responses

Browse pgsql-hackers by date

  From Date Subject
Next Message The Hermit Hacker 2001-04-13 23:16:39 Re: Anyone have any good addresses ... ?
Previous Message Bruce Momjian 2001-04-13 23:00:46 Re: Anyone have any good addresses ... ?