Re: Getting sequence value after inserting many rows at a time
В списке pgsql-sql по дате отправления:
| От | Bruno Wolff III |
|---|---|
| Тема | Re: Getting sequence value after inserting many rows at a time |
| Дата | |
| Msg-id | 20030110012515.GA22248@wolff.to обсуждение исходный текст |
| Ответ на | Getting sequence value after inserting many rows at a time (Maurício Sessue Otta <mauricio@cristorei.com.br>) |
| Список | pgsql-sql |
On Thu, Jan 09, 2003 at 22:48:11 -0200, Maurício Sessue Otta <mauricio@cristorei.com.br> wrote: > Hi, > > I have a PHP script that do something like this: > > INSERT INTO table_with_sequence (field1, field2...., fieldn) > SELECT field1, field2, ..., fieldn FROM table,table > WHERE condition, condition > > My doubt: > Will the rows just inserted in "table_with_sequence" always be sequencial? > (won't it happen to have X rows from this INSERT, 1 rows from another INSERT > in the middle and the rest rows of the first INSERT?) > > How can I safely get the first value the INSERT "generated" for > the sequence? You might want to reconsider the design. You might want to use another serial column to indicate the grouping. This will allow you to pick out records inserted as a group.
В списке pgsql-sql по дате отправления:
Сайт использует файлы cookie для корректной работы и повышения удобства. Нажимая кнопку «Принять» или продолжая пользоваться сайтом, вы соглашаетесь на их использование в соответствии с Политикой в отношении обработки cookie ООО «ППГ», в том числе на передачу данных из файлов cookie сторонним статистическим и рекламным службам. Вы можете управлять настройками cookie через параметры вашего браузера