pg.ddx.io  pgsql-sql@postgresql.org mailing list archive  
help / color / mirror / Atom feed
How to drop all the sequences
3+ messages / 3 participants
[nested] [flat]

* How to drop all the sequences
@ 2003-02-20 16:40  Arunachalam Jaisankar <arun_jaisankar@yahoo.com>
  0 siblings, 2 replies; 3+ messages in thread

From: Arunachalam Jaisankar @ 2003-02-20 16:40 UTC (permalink / raw)
  To: pgsql-sql

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

^ permalink  raw  reply  [nested|flat] 3+ messages in thread

* Re: How to drop all the sequences
@ 2003-02-20 20:39  Tomasz Myrta <jasiek@klaster.net>
  parent: Arunachalam Jaisankar <arun_jaisankar@yahoo.com>
  1 sibling, 0 replies; 3+ messages in thread

From: Tomasz Myrta @ 2003-02-20 20:39 UTC (permalink / raw)
  To: Arunachalam Jaisankar <arun_jaisankar@yahoo.com>; +Cc: 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




^ permalink  raw  reply  [nested|flat] 3+ messages in thread

* Re: How to drop all the sequences
@ 2003-02-21 08:04  Oleg Samoylov <olleg@telecom.mipt.ru>
  parent: Arunachalam Jaisankar <arun_jaisankar@yahoo.com>
  1 sibling, 0 replies; 3+ messages in thread

From: Oleg Samoylov @ 2003-02-21 08:04 UTC (permalink / raw)
  To: pgsql-sql

Arunachalam Jaisankar wrote:
> I found sequences are not getting dropped when tables are dropped. It is to=
> regards
> Jaisankar

In 7.3 sequence created automatically by serial field must be dropped 
with table.

-- 
Olleg Samoylov




^ permalink  raw  reply  [nested|flat] 3+ messages in thread


end of thread, other threads:[~2003-02-21 08:04 UTC | newest]

Thread overview: 3+ messages (download: mbox mbox.gz follow: Atom feed)
-- links below jump to the message on this page --
2003-02-20 16:40 How to drop all the sequences Arunachalam Jaisankar <arun_jaisankar@yahoo.com>
2003-02-20 20:39 ` Tomasz Myrta <jasiek@klaster.net>
2003-02-21 08:04 ` Oleg Samoylov <olleg@telecom.mipt.ru>

This inbox is served by DDX for PostgreSQL; see mirroring instructions
for how to clone and mirror all data and code used for this inbox