Problem with serial counters

Поиск
Список
Период
Сортировка
От Jacques Lebrun
Тема Problem with serial counters
Дата
Msg-id 7AD8C28EFB264E22BB784F83949DF0D2@Cplus.int
обсуждение исходный текст
Ответы Re: Problem with serial counters  (Vibhor Kumar <vibhor.aim@gmail.com>)
Re: Problem with serial counters  (Richard Huxton <dev@archonet.com>)
Список pgsql-sql
When I install my application, I use a SQL script to create the different tables.
Most of my tables start with a Serial column called RowId.
In my setup script I insert a few records into some tables, providing all fields, including the RowId (1, 2, 3, etc).
 
The problem I have is that when my user tries to insert a new record without the RowId field,
Postgres complains that it finds a duplicate key. 
I guess when I do an insert with all the fields (including the RowId), Postgres does not increment the serial counter.
 
I cannot remove the RowId field from the Insert of my setup script because this setup script is also used by customers using MySQL.
 
What can I do to force PostGres to update the internat serial counter when I do an insert with a specified value for the serial?
 
 
 
Jacques Lebrun
Web Mobile Inc
819-563-0133
JLebrun@cplus.org

В списке pgsql-sql по дате отправления:

Предыдущее
От: Isaac Dover
Дата:
Сообщение: Re: Compare two Data bases Structure
Следующее
От: Camaleon
Дата:
Сообщение: what's wrong in this procedure?