| От | Richard Huxton |
|---|---|
| Тема | Re: autoupdate sequences after copy |
| Дата | |
| Msg-id | 200310091002.58970.dev@archonet.com обсуждение исходный текст |
| Ответ на | autoupdate sequences after copy (CSN <cool_screen_name90001@yahoo.com>) |
| Список | pgsql-general |
On Thursday 09 October 2003 08:10, CSN wrote: > Is there a way to have p/k sequences get automatically > set to max(id)+1 after COPY's like the following? > > copy table1 (id,name) from stdin; > 1 abc > 2 def > 3 fhi > \. Not really - if you don't use the sequence it keeps its value. If you look at pg_dump it issues an explicit setval() after a copy. I'm not sure you can even work around it with a BEFORE trigger to check and update the sequence, the nextval() call will probably be processed before the trigger gets called (haven't checked). In any case, performance would be a bit poor. Is there any reason why you're supplying your own id values when you already have a sequence? -- Richard Huxton Archonet Ltd
В списке pgsql-general по дате отправления:
Сайт использует файлы cookie для корректной работы и повышения удобства. Нажимая кнопку «Принять» или продолжая пользоваться сайтом, вы соглашаетесь на их использование в соответствии с Политикой в отношении обработки cookie ООО «ППГ», в том числе на передачу данных из файлов cookie сторонним статистическим и рекламным службам. Вы можете управлять настройками cookie через параметры вашего браузера