We have an application which imports a significant
amount of data from a mainframe on a nightly basis.
The application which does this wraps its code in 
a BEGIN/END transacation.  During the process, 
indexes are dropped and recreated.  If the process is 
not successful, the indexes are left in an unusable 
state. Postgres always yeilds a:

ERROR:  Index k_vendors2 is not a btree

message.  Therefore, we changed the code to look like
this:

1. BEGIN
   ... do some stuff ...
   END

2. DROP index k_foo;
   COPY foo from 'import.txt'
   CREATE index k_foo;

3. BEGIN
   ... do some stuff ...
   END

The application, due to errors in the import data, 
is not completing to termination.  It is exitting
in block 3. However, the indexes on foo are left
corrupted.  We've had to go in and recreate them
by hand. The DROP/COPY/CREATE sequence in step 2
is performed on multiple tables...and all of them are
corrupted following the abnormal termination of the
process.

Any help with this issue would be greatly appreciated.

Marcus Mascari (mascarim@yahoo.com)





_________________________________________________________
Do You Yahoo!?
Get your free @yahoo.com address at http://mail.yahoo.com


Wed, 9 Jun 1999 23:24:23 -0700 (PDT)
Marcus Mascari <mascarim@yahoo.com>
Index corruption under PostgreSQL 6.5beta3
Marcus Mascari wrote:
> 
> The application, due to errors in the import data,
> is not completing to termination.  It is exitting
> in block 3. However, the indexes on foo are left

How is it exitting? ERROR, FATAL, ABORT?

> corrupted.  We've had to go in and recreate them
> by hand. The DROP/COPY/CREATE sequence in step 2
> is performed on multiple tables...and all of them are
> corrupted following the abnormal termination of the
> process.

Vadim

Thu, 10 Jun 1999 14:29:32 +0800
Vadim Mikheev <vadim@krs.ru>
Re: [HACKERS] Index corruption under PostgreSQL 6.5beta3