Re: template0

From: Josh Berkus <josh(at)agliodbs(dot)com>
To: "Marcel Wolf" <mwolfs(at)comcast(dot)net>, <pgsql-novice(at)postgresql(dot)org>
Subject: Re: template0
Date: 2004-02-06 00:30:15
Message-ID: 200402051630.15424.josh@agliodbs.com
Views: Raw Message | Whole Thread | Download mbox | Resend email
Thread:
Lists: pgsql-novice

Marcel,

> Let me be a little for specific. I am trying to make a php/pg/apache app
> that when run checks for its database and if not found creates it. To do
> this I first connect to pg first under template1 and check for my
> database in pg_database. If found I close and connect to that database.
> If not found I create it while connected to template1 and then close and
> connect under my database. Here is the code. Maybe I need to post this
> to the php site. But when I look at using a database I need to connect
> to it with a user and dbname. I have been using template1 successfully
> except any new databases after the first one inherit the tables from the
> 1st database and I though the way to get around this was to use
> template0? Am I out in left field about all this?

Your code creates the tables in template1, not in the new database. That's
your problem. You need to fix it so that you pg_connect to the newly
created database.

BTW, the approach you're taking is vey insecure and I hope you're not using it
on a public site anywhere.

--
-Josh Berkus
Aglio Database Solutions
San Francisco

In response to

  • template0 at 2004-02-05 23:32:59 from Marcel Wolf

Browse pgsql-novice by date

  From Date Subject
Next Message Josh Berkus 2004-02-06 00:31:56 Re: Where do I start?
Previous Message kynn 2004-02-06 00:25:17 Where do I start?