| От | Tom Lane |
|---|---|
| Тема | Re: Query for block updates |
| Дата | |
| Msg-id | 24732.1165184569@sss.pgh.pa.us обсуждение исходный текст |
| Ответ на | Query for block updates (Amit Shah <ashah@opuspro.com>) |
| Список | pgsql-sql |
Amit Shah <ashah@opuspro.com> writes:
> I am using this query - alter table optiondata ALTER volume TYPE numeric(20,4)
> using cast(volume as numeric(20,4)); then wait for DB to complain, and then
> update that value to null, and just keep doing this till all garbadge is
> removed :-(
You could automate it in plpgsql ... something like
for r in select id, val from tableloop begin perform cast(r.val as numeric(20,4)); exception when
...then update table set val = null where id = r.id; end;end loop;
and then do the ALTER TYPE after you've cleaned the data.
regards, tom lane
В списке pgsql-sql по дате отправления:
Сайт использует файлы cookie для корректной работы и повышения удобства. Нажимая кнопку «Принять» или продолжая пользоваться сайтом, вы соглашаетесь на их использование в соответствии с Политикой в отношении обработки cookie ООО «ППГ», в том числе на передачу данных из файлов cookie сторонним статистическим и рекламным службам. Вы можете управлять настройками cookie через параметры вашего браузера