Re: Creating DB programmatically?

From: Francisco Leovey <fleovey(at)yahoo(dot)com>
To: pgsql-novice(at)postgresql(dot)org, pgsql-novice-owner(at)postgresql(dot)org
Subject: Re: Creating DB programmatically?
Date: 2011-07-12 11:44:43
Message-ID: 1310471083.57754.YahooMailClassic@web39322.mail.mud.yahoo.com
Views: Raw Message | Whole Thread | Download mbox | Resend email
Thread:
Lists: pgsql-novice

I use a very simple perl program to get a list of databases and ask if you want a new one created and the desired encoding, and could add any other optional parameters.
The same is done in Webmin -

--- On Tue, 7/12/11, Jayadevan M <Jayadevan(dot)Maymala(at)ibsplc(dot)com> wrote:

From: Jayadevan M <Jayadevan(dot)Maymala(at)ibsplc(dot)com>
Subject: Re: [NOVICE] Creating DB programmatically?
To: "Roy's Email" <rmw256(at)hotmail(dot)com>
Cc: pgsql-novice(at)postgresql(dot)org, pgsql-novice-owner(at)postgresql(dot)org
Date: Tuesday, July 12, 2011, 12:16 AM

Hello,

>

> I would like to create my DB programmatically.  I.e. If the DB
does

> not already exist, I would like to be able to create (and populate)

> it from within my application.  Is there some way to do this?
 

> Everything I see seems to require connecting to an existing DB

> before you can do anything.

If it is unix/linux, couldn't you do

[postgres(at)tcctest ~]$ psql -l | grep mydatabase

and then create one if it did not fetch any data?

If it exists, you will get something like

 mydatabase | postgres | UTF8     |
en_US.UTF-8 | en_US.UTF-8 |

Regards,

Jayadevan

DISCLAIMER:

"The information in this e-mail and any attachment is intended only
for the person to whom it is addressed and may contain confidential and/or
privileged material. If you have received this e-mail in error, kindly
contact the sender and destroy all copies of the original communication.
IBS makes no warranty, express or implied, nor guarantees the accuracy,
adequacy or completeness of the information contained in this email or
any attachment and is not liable for any errors, defects, omissions, viruses
or for resultant loss or damage, if any, direct or indirect."

In response to

Browse pgsql-novice by date

  From Date Subject
Next Message Pushpendra Singh Thakur 2011-07-12 14:30:19 Re: Creating DB programmatically?
Previous Message Frank Bax 2011-07-12 11:44:26 Re: Creating DB programmatically?