Re: Newbie wonder... - Mailing list pgsql-sql

From PFC
Subject Re: Newbie wonder...
Date
Msg-id opsnmd1uimth1vuj@localhost
Whole thread Raw
In response to Newbie wonder...  (Bernard Grosperrin <bernard@bgsoftfactory.com>)
Responses Re: Newbie wonder...
List pgsql-sql
If you want to add a SERIAL field to an existing table, create a sequence  
and then create an integer field with default nextval(seq) and postgres  
will fill it automatically. The order in which it will fill it is not  
guaranteed though !
However, you might also like to de-dupe your data once it's in the  
additional tables, thus you might need more complicated measures.


> (2) How should I go to create a sequence for an existing table? For all
> futures data entry, after this conversion, I want the unique ID for each
> row to come from a sequence, but if I know how to create a table using
> serial, I am not sure how to modify one for this.
>
> Thanks,
> Bernard
>
> ---------------------------(end of broadcast)---------------------------
> TIP 6: Have you searched our list archives?
>
>                http://archives.postgresql.org
>




pgsql-sql by date:

Previous
From: PFC
Date:
Subject: Re: group by before and after date
Next
From: Christoph Haller
Date:
Subject: Re: How to cast VARCHAR to BYTEA and vice-versa?