Re: Problem with serial counters

Поиск
Список
Период
Сортировка
От Richard Huxton
Тема Re: Problem with serial counters
Дата
Msg-id 4D6D5737.3030208@archonet.com
обсуждение исходный текст
Ответ на Problem with serial counters  ("Jacques Lebrun" <jlebrun@cplus.org>)
Список pgsql-sql
On 24/02/11 21:09, Jacques Lebrun wrote:
> 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.

Apart from Vibhor's suggestion (which is the typical way PG does it) you 
can also set the auto field to DEFAULT:

INSERT INTO mytable (rowid, other) VALUES (DEFAULT,'a'), (DEFAULT,'b');

This should work on either system.

--   Richard Huxton  Archonet Ltd


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

Предыдущее
От: Rob Sargent
Дата:
Сообщение: Re: distinguishing identical columns after joins
Следующее
От: S G
Дата:
Сообщение: Re: distinguishing identical columns after joins