RE: [SQL] Simple Question?? - Mailing list pgsql-sql

From Michael Davis
Subject RE: [SQL] Simple Question??
Date
Msg-id 93C04F1F5173D211A27900105AA8FCFC14520E@lambic.prevuenet.com
Whole thread Raw
List pgsql-sql
I would say yes as long as table_b still references the same sequence as
table_a.  Sequences are stored and maintained separately from the tables
they are used in.  If you drop and recreate a sequence, the starting number
of that sequence will be 1 even though the database using the sequence has
500 records in it.  You can reset the value of the sequence (seq_a) to the
highest value currently stored in the database for the column that seq_a is
being used with.  When I ported my Access97 table to Postgres, I had to set
the value of each sequence I used to match the highest value stored in my
tables.

    -----Original Message-----
    From:    archiver [SMTP:archiver@db.geocrawler.com]
    Sent:    Saturday, February 27, 1999 3:51 PM
    To:    pgsql-sql@hub.org
    Subject:    [SQL] Simple Question??

    Here's a question that maybe you can answer easily...

    If I am using a sequence (seq_a) in table_a

    ...then "create table_b as select * from table_a"

    ...does table_b start using that sequence (seq_a), starting at the
point
    where table_a left off??

    I have a 1GB table that I want to optimize by reordering it, and I
will want
    the new table to use the same sequence to generate the primary key.
I will
    then drop the original table and rename the table_b to table_a.

    Any clues?

    Tim Perdue
    tim@perdue.net


pgsql-sql by date:

Previous
From: luvisi@andru.sonoma.edu (Andru Luvisi)
Date:
Subject: Re: pgsql-sql-digest V1 #155
Next
From: pierre@desertmoon.com
Date:
Subject: 6.4.x to 6.5