X-Original-To: pgsql-admin@postgresql.org Received: from spampd.localdomain (postgresql.org [64.49.215.8]) by postgresql.org (Postfix) with ESMTP id EFC69475F26 for ; Mon, 28 Apr 2003 18:06:48 -0400 (EDT) Received: from mta04.onolab.com (smtp.ono.com [62.42.230.12]) by postgresql.org (Postfix) with ESMTP id A4844475B47 for ; Mon, 28 Apr 2003 18:06:44 -0400 (EDT) Received: from 81-203-14-163.user.ono.com ([81.203.14.163]) by mta04.onolab.com (Netscape Messaging Server 4.15) with ESMTP id HE2QR901.I8M for ; Tue, 29 Apr 2003 00:06:45 +0200 From: Juan Miguel To: pgsql-admin@postgresql.org Subject: Postgres 7.3, pg_dump, pg_restore and "lo" type Date: Tue, 29 Apr 2003 00:09:23 +0200 User-Agent: KMail/1.5 MIME-Version: 1.0 Content-Type: text/plain; charset="iso-8859-1" Content-Transfer-Encoding: quoted-printable Content-Disposition: inline Message-Id: <200304290009.23374.juanmime@ono.com> X-Spam-Status: No, hits=-6.6 required=5.0 tests=BAYES_01,USER_AGENT version=2.50 X-Spam-Level: X-Spam-Checker-Version: SpamAssassin 2.50 (1.173-2003-02-20-exp) X-Archive-Number: 200304/375 X-Sequence-Number: 8530 Hello, First, sorry about my english. I have compiled and installed Postgres 7.3 Database Server, on Linux. I mad= e=20 an DB where same tables need BLOB columns, and I thought to use the "lo"=20 type, present in the contrib dir. This type is perfet for me, because I access remotely to the DB by ODBC, an= d=20 manage the orphan "oids" erasing these objects when we drop the afected row= s. Well. Some day ago, I did a database dump, for replicate the information in= =20 other server (same PostgreSql Version, Linux, ...). I dumped this database with largeobjects, something similar to : pg_dump -o= -b=20 -C -Ft -U myuser mydb > backup.tar After, when I try to recover the database using pg_restore in the new serve= r.=20 These are the steps that I did: 1. Create the database structure. pg_restore -Ft -v -s -o -U -C myuser -d test backup_20030425.tar OPTION A. =3D=3D=3D=3D=3D=3D=3D=3D 2.- Restore the datas. pg_restore -Ft -v -a -o -U myuser -d mydb backup_20030425.tar This is the result: pg_restore: connecting to database for restore pg_restore: executing Max OID pg_restore: restoring data for table BLOBS pg_restore: restoring large object OID 74763 pg_restore: connecting to database inmobayo as user inmouser pg_restore: creating table for large object cross-references pg_restore: restoring large object OID 74765 pg_restore: restoring large object OID 74767 pg_restore: restoring large object OID 74769 pg_restore: restoring large object OID 74771 pg_restore: restoring large object OID 74773 pg_restore: restoring large object OID 74775 pg_restore: restoring large object OID 74777 pg_restore: restoring large object OID 74779 pg_restore: restoring large object OID 74781 pg_restore: restoring large object OID 74783 pg_restore: restoring large object OID 74785 pg_restore: restoring large object OID 74787 pg_restore: restoring large object OID 74789 pg_restore: restoring large object OID 74791 pg_restore: restoring large object OID 74793 pg_restore: restoring large object OID 74795 pg_restore: restoring large object OID 74797 pg_restore: restoring large object OID 74799 pg_restore: restoring large object OID 74801 pg_restore: restoring large object OID 74803 pg_restore: restored 21 large objects pg_restore: restoring data for table reportinfo pg_restore: [tar archiver] could not find header for file 127.dat in tar= =20 archive pg_restore: *** aborted because of error =BF Why ? If I untar the file "backup_20030425.tar", the file 127.dat exis= ts. OPTION B. =3D=3D=3D=3D=3D=3D=3D=3D 2.- If I try to recover the data without the "-o" option (pg_restore -Ft -= v=20 -a -U myuser -d mydb backup_20030425.tar) , now the error is: pg_restore: [archiver (db)] error while updating column "photo" of table "photos": ERROR: Unable to identify an operator '=3D' for types 'oid'= and=20 'lo' You will have to retype this query using an explicit cast. OPTION C. =3D=3D=3D=3D=3D=3D=3D=3D 2.- Doing some little tricks, I can cast "oid as lo" and viceversa, then If= I=20 try again, now the error is: pg_restore: fixing up large object cross-reference for photos pg_restore: fixing large object cross-references for photos.photo pg_restore: [archiver (db)] error while updating column "photo" of table "photos": ERROR: LargeObjectDrop: large object 74763 not found The origin of this error is the TRIGGER BEFORE DELETE OR UPDATE, of the= =20 table photos. I think that pg_restore now, recover the BLOBS with diferents= =20 oids, and try to UPDATE the records of the table, but then, the TRIGGER try= =20 to drop the old OID =3D=3D=3D=3D> Errrorrr !!!! Is there any way of recover the data using pg_dunp and pg_restore ? I ne= ed=20 a systematic method for doing backups and restore in the new or old server.= =20 It's urgent and I need those datas on the new server. Thanks very much.