Обсуждение: How to Create a Database Dynamically Using PostgreSQL

Поиск
Список
Период
Сортировка

How to Create a Database Dynamically Using PostgreSQL

От
"Vishnu S."
Дата:
<div class="Section1"><p class="MsoNormal"> <p class="MsoNormal">Hi,<p class="MsoNormal"> <p class="MsoNormal">I am New
inPostgreSQL. I want to know how we create a Database dynamically using a postgresql function. <p
class="MsoNormal">WhenI tried to create a Database like that,I got an error like the following,<p
class="MsoNormal">“CREATEDATABASE cannot be executed from a function or multi-command string”.<p class="MsoNormal"> <p
class="MsoNormal"> <pclass="MsoNormal"> <p class="MsoNormal"> <p class="MsoNormal"><span
style="font-size:12.0pt;font-family:"FootlightMT Light","serif"">Thanks & Regards,</span><p class="MsoNormal"><span
style="font-size:12.0pt;font-family:"FootlightMT Light","serif"">Vishnu S</span><p class="MsoNormal"> </div> *****
ConfidentialityStatement/Disclaimer ***** <br /><br />This message and any attachments is intended for the sole use of
theintended recipient. It may contain confidential information. Any unauthorized use, dissemination or modification is
strictlyprohibited. If you are not the intended recipient, please notify the sender immediately then delete it from all
yoursystems, and do not copy, use or print. Internet communications are not secure and it is the responsibility of the
recipientto make sure that it is virus/malicious code exempt.<br /><br />The company/sender cannot be responsible for
anyunauthorized alterations or modifications made to the contents. If you require any form of confirmation of the
contents,please contact the company/sender. The company/sender is not liable for any errors or omissions in the content
ofthis message.<br /> 

Re: How to Create a Database Dynamically Using PostgreSQL

От
Raymond O'Donnell
Дата:
On 10/08/2009 05:44, Vishnu S. wrote:

> I am New in PostgreSQL. I want to know how we create a Database
> dynamically using a postgresql function.
> 
> When I tried to create a Database like that,I got an error like the
> following,
> 
> “CREATE DATABASE cannot be executed from a function or multi-command
> string”.

This question really belongs on the pgsql-general list, as it's not
related to PgAdmin.

However, do you need to do it from a function? You could just run the
SQL "create database..." command, assuming that your user has the
necessary privileges.

Ray.

------------------------------------------------------------------
Raymond O'Donnell, Director of Music, Galway Cathedral, Ireland
rod@iol.ie
Galway Cathedral Recitals: http://www.galwaycathedral.org/recitals
------------------------------------------------------------------