Re: How to drop all the sequences

Поиск
Список
Период
Сортировка
От Tomasz Myrta
Тема Re: How to drop all the sequences
Дата
Msg-id 3E553D04.6070407@klaster.net
обсуждение исходный текст
Ответ на How to drop all the sequences  ("Arunachalam Jaisankar" <arun_jaisankar@yahoo.com>)
Список pgsql-sql
Arunachalam Jaisankar wrote:
> I found sequences are not getting dropped when tables are dropped. It is 
> too difficult to drop all sequences one by one manually. Is there any 
> command to drop all sequences in a database? Looking for help.
>  
> regards
> Jaisankar
Try this simple pl/pgsql function:

create or replace function drop_all_sequences() returns integer as '
declare rec record;
begin for rec in select relname as seqname   from pg_class where relkind=''S'' loop   execute ''drop sequence '' ||
rec.seqname;end loop; return 1;
 
end;
' language 'plpgsql';

Regards,
Tomasz Myrta



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

Предыдущее
От: Dave Gomboc
Дата:
Сообщение: Re: select from update from select?
Следующее
От: Mark Mitchell
Дата:
Сообщение: Nth Select