JT Kirkpatrick <[EMAIL PROTECTED]> writes:
> Hi all.  Head hanging a little low, even though system still seems to work 
> fine.  Here is what I did:

> - update pg_class set relname = lower(relname);
> - update pg_attribute set attname = lower(attname);

That shouldn't really hurt anything for the standard Postgres tables,
since the names used are all lowercase already.  I suppose that you
had some user-created tables with names that were partially or wholly
uppercase?  And that after folding to lowercase, there are duplicate
table names in there?

The only answer I can see is to go in and manually update the duplicate
entries not to be duplicates.  Eg,
        update pg_class set relname = 'OriginalName' where oid = whatever;

You can look for the duplicates with something like

select p1.oid,p2.oid,p1.relname from pg_class p1, pg_class p2
where p1.relname = p2.relname and p1.oid != p2.oid;

After you get rid of the duplicates, a vacuum should work again.
I think.  If not, at least you'll be able to make a valid dump of
the database so you can destroy and recreate it.

Good luck, and try to remember not to manually modify system classes
in the future ;-).  (Actually I thought there was an interlock in there
to prevent this ... but I guess if you are running as Postgres superuser
there is not.  Just as in Unix sysadmin work, it's best not to be the
superuser anytime you don't have to be.)

BTW, it's probably not good practice to have different table names that
are the same except for case, since the Postgres parser is usually
case-insensitive.

                        regards, tom lane

Reply via email to