pg.ddx.io  pgsql-sql@postgresql.org mailing list archive  
help / color / mirror / Atom feed
From: Ben Morrow <ben@morrow.me.uk>
To: pgsql-sql@postgresql.org
Subject: Re: Creating a new database with a TEMPLATE did not work
Date: Tue, 26 Feb 2013 02:46:54 +0000
Message-ID: <20130226024654.GA64903@anubis.morrow.me.uk> (raw)
In-Reply-To: <512BEC17.6060403@gmail.com>
References: <1361832568260-5746627.post@n5.nabble.com>
List-Unsubscribe: <mailto:majordomo@postgresql.org?body=unsub%20pgsql-sql>

Quoth adrian.klaver@gmail.com (Adrian Klaver):
> On 02/25/2013 02:49 PM, mkumbale wrote:
> > Hi, I am new to PostgreSQL.  I have an empty PostgreSQL DB containing tables
> > but no data.  I issued the following command in PGADMIN SQL editor:
> >
> > CREATE DATABASE "NewDefault"
> >    WITH OWNER = postgres
> >         ENCODING = 'UTF8'
> >         TEMPLATE = Default
> >         TABLESPACE = pg_default
> >         LC_COLLATE = 'English_United States.1252'
> >         LC_CTYPE = 'English_United States.1252'
> >         CONNECTION LIMIT = -1;
> >
> > Although it created the NewDefault DB, it does not contain any of the tables
> > in Default.  Default was disconnected when I executed this command.
> >
> > What am I doing something wrong?
> 
> So you have a database named Default?
> 
> Probably not a good name because:
> http://www.postgresql.org/docs/9.2/interactive/sql-createdatabase.html
> 
> template
> The name of the template from which to create the new database, or 
> DEFAULT to use the default template (template1).
> 
> So at a guess you are actually creating the new database from template1.

Also, SQL names are folded to lowercase unless they are quoted, so

    TEMPLATE = Default

would refer to a database called "default" (if it weren't special syntax
for template1), but

    TEMPLATE = "Default"

should find a database created with CREATE DATABASE "Default".

Ben



-- 
Sent via pgsql-sql mailing list (pgsql-sql@postgresql.org)
To make changes to your subscription:
http://www.postgresql.org/mailpref/pgsql-sql



view thread (4+ messages)  latest in thread

Message-ID: <20130226024654.GA64903@anubis.morrow.me.uk>
Permalink:  ../20130226024654.GA64903@anubis.morrow.me.uk/
Also on:    postgresql.org/message-id/20130226024654.GA64903@anubis.morrow.me.uk

 · 

reply

Reply instructions:

You may reply publicly to this message via plain-text email
using any one of the following methods:

* Reply to all the recipients using the --to and --cc options:
  reply via email

  To: pgsql-sql@postgresql.org
  Cc: ben@morrow.me.uk
  Subject: Re: Creating a new database with a TEMPLATE did not work
  In-Reply-To: <20130226024654.GA64903@anubis.morrow.me.uk>

* Save the following mbox file, import it into your mail client,
  and reply-to-all from there: mbox

This inbox is served by DDX for PostgreSQL; see mirroring instructions
for how to clone and mirror all data and code used for this inbox