oids vs. serial question
От | Alex Rice |
---|---|
Тема | oids vs. serial question |
Дата | |
Msg-id | F2365117-2D71-11D6-9917-0030653DEAA0@arc.to обсуждение исходный текст |
Ответы |
Re: oids vs. serial question
Re: oids vs. serial question |
Список | pgsql-general |
Hi, I'm new to PostreSQL, and I fear this might be a FAQ. I am considering using OIDs for my application. I like the fact that they are just automagic. However, the magic seems to disappear when it comes to dumping and restoring data. Is there a way to get references to oids across tables get restored correctly? I see that pg_dump has --oids and pg_restore has --oid-order. But when I do a restore using --oid-order, my oid references are all off by a constant number. For example, if I have a oid column that is a references between these two tables: CREATE TABLE park ( region_oid oid references region, primary key (oid), ... ); CREATE TABLE region ( PRIMARY KEY (oid), ... ) ; Then I do pg_dump -Fc --oids > my.db [drop tables] pg_restore -Fc --oid-order my.db Then the region_oid column values do not match the current oids in region.oid. It can be fixed with a query, but someone (me) is sure to forget to do this cleanup. update park set region_oid = region_oid + DELTA where DELTA is the difference of min(region.oid) and min(park.region_oid) Am I missing something with the use of dump and restore, or should I just forget it and use SERIAL columns? Alex Rice, Software Developer Architectural Research Consultants, Inc. alex_rice@arc.to alrice@swcp.com
В списке pgsql-general по дате отправления: