Restoring Backup With OIDs As Primary Key

Поиск
Список
Период
Сортировка
Искать

Restoring Backup With OIDs As Primary Key

От:
"Ben C" <ben.c@ect.com.au>
Дата:

Hello,

I am trying to restore from a backup db that used oids as primary keys * ... when I do this the max oid value in the new database is around the 1700 mark where as the database I am pulling in is around 20,000,000 . which means any new data added to the dataabse is going to be clobbered.

Is there a way to increment the OID by changing a value in the system tables?

thanks in advance

* at the time this was implemented way back at 7.x, from what I had read it seemed like acceptable practice :/

Re: Restoring Backup With OIDs As Primary Key

От:
Andrew Sullivan <ajs@commandprompt.com>
Дата:
On Tue, Aug 26, 2008 at 01:30:23PM +1000, Ben C wrote:
> 
> Is there a way to increment the OID by changing a value in the system tables? 

I don't think so, but I just tried creating a table in 8.3 with a
column named "oid", and it worked.  Maybe you can load in your data
that way, so that you don't need to change your application.  (I'd
test it a little more carefully for side effects than I just did, mind.)

A
-- 
Andrew Sullivan
ajs@commandprompt.com
+1 503 667 4564 x104
http://www.commandprompt.com/

Re: Restoring Backup With OIDs As Primary Key

От:
Alvaro Herrera <alvherre@commandprompt.com>
Дата:
Ben C wrote:

> Is there a way to increment the OID by changing a value in the system tables? 

Not a system table, but you can with pg_resetxlog -o.

-- 
Alvaro Herrera                                http://www.CommandPrompt.com/
The PostgreSQL Company - Command Prompt, Inc.
FAQ