create databases with plpgsql

Поиск
Список
Период
Сортировка
От sirius
Тема create databases with plpgsql
Дата
Msg-id 3E929C3D.3010704@hsw.fhz.ch
обсуждение исходный текст
Ответы Re: create databases with plpgsql  (Olleg Samojlov <olleg@telecom.mipt.ru>)
Список pgsql-sql
a novice has the following challenge (problem):

I would like to create a certain number of new databases named stud01, 
stud02...to stud25 with a plpgsql-script. But I have difficulties to 
create a new database with a script. I saw a lot of different scripts in 
the manuals to create tables, but no new db.

Generally, is it possible at all? Do you may have any suggestions, 
workarounds, ideas?

any help will be appreciated...

I tried the these simple script without any loop, unfortunately without 
success:

create or replace function createDB(text) returns text as '
DECLARE   DBname ALIAS FOR $1;   sqlquery text;   result text;
BEGIN   sqlquery := ''CREATE DATABASE %'', DBname;   EXECUTE( sqlquery );   RETURN DBname
END;
' language 'plpgsql';

Thank you for your help

sirius



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

Предыдущее
От: "Ramesh PAtel "
Дата:
Сообщение: Problem about Triggers and Function
Следующее
От: Josh Berkus
Дата:
Сообщение: Re: Problem about Triggers and Function