Question about serial vs. int datatypes

From: Lynna Landstreet <lynna(at)gallery44(dot)org>
To: <pgsql-general(at)postgresql(dot)org>
Subject: Question about serial vs. int datatypes
Date: 2003-06-05 20:05:53
Message-ID: BB051AE1.107%lynna@gallery44.org
Views: Raw Message | Whole Thread | Download mbox | Resend email
Thread:
Lists: pgsql-general

Not sure if the lists are currently working - I just joined both this one
and pgsql-novice, and posted a message to that one earlier in the day, but I
haven't received either any replies or even my own message back, so I don't
know if it's working. I know there was some kind of hardware failure with
regard to the lists, but I don't know how severe.

Anyway: I'm converting a FileMaker Pro database into PostgreSQL, and have a
question (actually, tons of questions, but I'll stick to one for now). Each
of the three major database files in FMP (equivalent to tables in
PostgreSQL) has a number field as a primary key which is incremented
serially as new records are added. Nice and simple, and the same thing a lot
of PostgreSQL databases use.

But... when converting an existing database that already has several hundred
records in it, I can't make that field serial in PostgreSQL, can I? Because
I don't want the existing records renumbered - that would break the links
between the different tables. But if I make the id number just a smallint
field, then I'm stuck incrementing it manually after the conversion. Is
there any way around this? Any way to import the existing records with their
id number intact, and then have it switch to serial after that for new
records?

Any advice would be appreciated...

Lynna
--
Resource Centre Database Coordinator
Gallery 44
www.gallery44.org

Responses

Browse pgsql-general by date

  From Date Subject
Next Message Ron Mayer 2003-06-05 21:22:33 Re: [HACKERS] SAP and MySQL ... [and Benchmark]
Previous Message Sean Chittenden 2003-06-05 19:15:56 Re: Anonymous CVS access