CLUSTER statement fails with 'server closed the connection unexpectedly'

The following command use to work:

wts1=# CLUSTER inv_search4_idx ON Invoice ;

But now I am getting the following error:

server closed the connection unexpectedly
        This probably means the server terminated abnormally
        before or while processing the request.
The connection to the server was lost. Attempting reset: Failed.

OS Info:
  Postrgesql 7.4.7
  Fedora Core 2

The actual script looks like:

# Knock off any users.  They shouldn't be up this late!

/sbin/service postgresql restart

echo -e "\n-->Re-Clustering Orderdate Index on Invoice Table"

/usr/bin/psql -h wts1 <<EOF
CLUSTER inv_search4_idx ON Invoice ;

echo -e "\nDone"

Thanks in advance

Mike HaganConsultantAsked:
Who is Participating?

[Product update] Infrastructure Analysis Tool is now available with Business Accounts.Learn More

I wear a lot of hats...

"The solutions and answers provided on Experts Exchange have been extremely helpful to me over the last few years. I wear a lot of hats - Developer, Database Administrator, Help Desk, etc., so I know a lot of things but not a lot about one thing. Experts Exchange gives me answers from people who do know a lot about one thing, in a easy to use platform." -Todd S.

Your firewall(or NAT router) in the middle closed connection...
earth man2Commented:
Maybe you have found a bug in PostgreSQL 7.4.7

Try instead

    SELECT columnlist FROM table ORDER BY columnlist;

which uses the PostgreSQL sorting code in the ORDER BY clause to create the desired order; this is usually much faster than an index scan for unordered data. You then drop the old table, use ALTER TABLE ... RENAME to rename newtable to the old name, and recreate the table's indexes. However, this approach does not preserve OIDs, constraints, foreign key relationships, granted privileges, and other ancillary properties of the table — all such items must be manually recreated.

Maybe you could upgrade to the latest version of PostgreSQL and the problem MAY go away.

Experts Exchange Solution brought to you by

Your issues matter to us.

Facing a tech roadblock? Get the help and guidance you need from experienced professionals who care. Ask your question anytime, anywhere, with no hassle.

Start your 7-day free trial
Mike HaganConsultantAuthor Commented:
To gheist:

I thought of this.  The sql fails on the local machine.
Mike HaganConsultantAuthor Commented:
To earthman2:

I am getting ready to upgrade to Fedora Core 4 ... I'm not quite ready to jump to 5.  I have scripts that create my index and reset the OID.  I can use your solution in the interim without much effort.

If you can get new machine then try any distribution with 8.x.y, if it works prepare to jump.
It's more than this solution.Get answers and train to solve all your tech problems - anytime, anywhere.Try it for free Edge Out The Competitionfor your dream job with proven skills and certifications.Get started today Stand Outas the employee with proven skills.Start learning today for free Move Your Career Forwardwith certification training in the latest technologies.Start your trial today

From novice to tech pro — start learning today.