[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]

Re: rebuild tables with OIDS



>>>>> "Joseph" == Joseph  <..hidden..> writes:
    >> The only way I was able to do this was, for each table, create a
    >> new table with a new name, insert into newtable from oldtable,
    >> and then rename.  I can't write the SQL from the top of my head,
    >> but if you like I'll look it up.

    Joseph> If you can gid out a link or recall anything it would give
    Joseph> me a start, thanks in advance.

    >> Maybe someone else has a better solution.  You could also restore
    >> a backup, I think.

  Basically, for each table, I did:

ALTER TABLE foo RENAME TO foo_old;
CREATE TABLE foo LIKE foo_old WITH OIDS;
INSERT INTO foo VALUES ( SELECT * from foo_old );
DROP TABLE foo_old;

  It is possible that you have to turn off foreign key checks for some
things.


    Joseph> I'm upgrading from an older database so I don't have a
    Joseph> backup.

  You can make one with pgdump...

-- 
]       He who is tired of Weird Al is tired of life!           |  firewalls  [
]   Michael Richardson, Sandelman Software Works, Ottawa, ON    |net architect[
] ..hidden.. http://www.sandelman.ottawa.on.ca/ |device driver[
] panic("Just another Debian GNU/Linux using, kernel hacking, security guy"); [