Schema handling within plpgsql

From: George McQuade <gm(at)winls(dot)com>
To: pgsql-novice(at)postgresql(dot)org
Subject: Schema handling within plpgsql
Date: 2005-10-05 22:45:45
Message-ID: 1128552346.3079.42.camel@sat1
Views: Raw Message | Whole Thread | Download mbox | Resend email
Thread:
Lists: pgsql-novice

Hello list,

I need to setup some 80 schemas for work.

What is the proper plpgsql syntax for looping through schemas?
(postgresql 7.4.1)

Ideally it would be nice to do something like:

for schema in 1,2,3,4,5
do
create $schema.table ...
insert into $schema.table select ....
done

I know this can be done from a shell and invoke psql each time, just
wondering if it all can be contained inside plpgsql scripts.

Thanks

george

Responses

Browse pgsql-novice by date

  From Date Subject
Next Message Derrick Betts 2005-10-05 23:03:46 Re: PL/pgSQL - Sytax Error near $1 ?
Previous Message Emre Bastuz 2005-10-05 20:36:01 PL/pgSQL - Sytax Error near $1 ?