Re: import and foreign keys
От | Richard Seymour |
---|---|
Тема | Re: import and foreign keys |
Дата | |
Msg-id | 3A6EB6F6.4888524@anarchysoftware.com обсуждение исходный текст |
Ответ на | import and foreign keys ("Thomas T. Thai" <tom@minnesota.com>) |
Список | pgsql-general |
If you build your strucutres as you've shown (explicitely creating your sequences), and then import, you shouldn't have any problem, with one caveat. You'll need to determine the hightest current key for each table and start your sequence accordingly. To start a squence at 500: > CREATE SEQUENCE "next_url_id" start 500 increment 1 maxvalue 2147483647 "Thomas T. Thai" wrote: > > i'm in the process of importing my data from my existing db (mysql) to > pgsql. one thing i'm confused about is the use of foreign keys. in my > existing db, i use the foreign keys to relate from one table to the > next. it's a forum type application. the key is based on an auto-increment > field. > ... > i'm wondering what will happen to that field if i import into pgsql? will > pgsql figure out what the last highest id is and continue from > there? assuming i've defined my table structures properly using: > > CREATE SEQUENCE "next_url_id" start 1 increment 1 maxvalue 2147483647 > > CREATE TABLE "url" ( > "rec_id" integer DEFAULT nextval('next_url_id'::text) NOT NULL, > ... -- Richard Seymour : Anarchy Software, Inc. - * - - * - - - * -+- * - - - * - - * - `°º¤ø,¸ ¸,ø¤º°' `°º¤ø,¸¸,ø¤º°
В списке pgsql-general по дате отправления: