Re: SERIAL type fields
От | Andrew Ayers |
---|---|
Тема | Re: SERIAL type fields |
Дата | |
Msg-id | 3EA83E5C.7090308@eldocomp.com обсуждение исходный текст |
Ответы |
Re: SERIAL type fields
Re: SERIAL type fields |
Список | pgsql-general |
All, I have been doing a conversion of an Access 97 database to PostgreSQL - so far things have been going relatively smoothly. However, I am now running into a minor issue - one could almost say it is an asthetic issue more than anything. In the conversion of my Access tables, to a number of them I had to add a unique key field. I decided to use a SERIAL type for these fields, which set up a "sequence" table (table_field_seq) for each table that uses one. I am now in a process of doing a multiple conversion of data to these new tables, where I clear out the table then reload it with new data. What I came across was that I wanted to reset the sequence number so that when the new records were added, they would start at number "1" and increase from there. When you create the table from new, it does this - but after that, the sequence table says that the minimum value for the sequence is "1" - and not zero - so that when you add records to the table the sequence is used on, the first record has a value of "2" in that field when it is added. I tried to reset the minimum value to "0" - but it wouldn't let me. Does anyone know of how you do this, without having to DROP the table and sequence, and re-creating them? Is there some kind of ALTER TABLE command, or possibly something the database setup, that would allow me to alter this behavior? Thank you for any answers you can provide... Andrew L. Ayers
В списке pgsql-general по дате отправления: