Subject Re: [firebird-support] reorganise id's
Author Werner F. Bruhin
Hi Martin,

martinknappe wrote:
> hello
> i'm pretty new to firebird and i find the documentation a bit
> overwhelming so please don't be bothered if i'm asking a question i
> wouldn't have to ask if i'd rtfm
>
> if you create a database with different tables and an integer primary
> key for every table, you can't be helped but get a database with ever
> more gaps in between these primary keys as you insert new records and
> delete old ones, right? now, is there a way to reorganise such a gappy
> database, i.e., a way to have the database "recreated" with the same
> data but with all entries after such gaps being placed?
What is the actual problem you are trying to solve?

Primary keys should just about never be shown to the user, so what does
it matter if there are gaps.

You could renumber the ID, but you would have to ensure that all
relations get correctly updated.

If you need a consecutive number for a particular reason, I would then
NOT use it as the primary key, i.e. just have a second column/field for it.

Werner
>
> thanx,
>
> martin
>
>
>
>
>
>
>
> ++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++
>
> Visit http://firebird.sourceforge.net and click the Resources item
> on the main (top) menu. Try Knowledgebase and FAQ links !
>
> Also search the knowledgebases at http://www.ibphoenix.com
>
> ++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++
>
> Yahoo! Groups Links
>
>
>
>
>
>
>