Subject: oid mapping

From: Peter van Oosterom <[email-masked]>
Date: Fri, 1 Nov 91 18:14:21 MET

Dear Postgres group,

The reference manual distributed with version 2.0.3 contained a section
on oid mapping in the postquel copy command. This section has disappeared
in the latest reference manual. However, oid mapping is important in case
you want to copy a database from one postgres installation to another.
The oid mapping described in reference manual version 2.0.3 is not
sufficient for this purpose. The auxiliary relation which
contains the mapping of old oid's to new oid's can not be filled
because the copy to and from are performed on two different installations.

A reasonable solution for the oid mapping is illustrated with an example:
ON SYSTEM A:
   create people(name=char16,parent=oid)
   append's.....
   retrieve into cppeople (oldoid=people.oid, people.all)
   copy cppeople to "/tmp/people.data"

(transport file /tmp/people.data from A to B)
ON SYSTEM B:
   create people(oldoid=oid,name=char16,parent=oid)
   copy people from "/tmp/people.data"
   replace people(parent=p.oid) from p in people where p.oldoid=people.parent
   dropattr (oldoid) from people

Everything works, except the last two lines. The replace command causes an
infinite loop. Of course the command dropattr is not present, but it
should be able to implement this similar to addattr.
Another disadvantage is that this method is clumsy. For example the
cppeople-relation would not be needed if something like
   copy people(oldoid=oid,all) to "/tmp/people.data"
was possible. Is there a (better) method to solve this problem?

Regards, Peter van Oosterom.