pg.ddx.io  pgsql-sql@postgresql.org mailing list archive  
help / color / mirror / Atom feed
Creating a new database with a TEMPLATE did not work
4+ messages / 3 participants
[nested] [flat]

* Creating a new database with a TEMPLATE did not work
@ 2013-02-25 22:49  mkumbale <mkumbale@gmail.com>
  0 siblings, 2 replies; 4+ messages in thread

From: mkumbale @ 2013-02-25 22:49 UTC (permalink / raw)
  To: pgsql-sql

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?

Thanks,
Murali



--
View this message in context: http://postgresql.1045698.n5.nabble.com/Creating-a-new-database-with-a-TEMPLATE-did-not-work-tp57466...
Sent from the PostgreSQL - sql mailing list archive at Nabble.com.


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



^ permalink  raw  reply  [nested|flat] 4+ messages in thread

* Re: Creating a new database with a TEMPLATE did not work
@ 2013-02-25 22:56  Adrian Klaver <adrian.klaver@gmail.com>
  parent: mkumbale <mkumbale@gmail.com>
  1 sibling, 1 reply; 4+ messages in thread

From: Adrian Klaver @ 2013-02-25 22:56 UTC (permalink / raw)
  To: mkumbale <mkumbale@gmail.com>; +Cc: pgsql-sql

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.

>
> Thanks,
> Murali
>
>
>
> --
> View this message in context: http://postgresql.1045698.n5.nabble.com/Creating-a-new-database-with-a-TEMPLATE-did-not-work-tp57466...
> Sent from the PostgreSQL - sql mailing list archive at Nabble.com.
>
>


-- 
Adrian Klaver
adrian.klaver@gmail.com


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



^ permalink  raw  reply  [nested|flat] 4+ messages in thread

* Re: Creating a new database with a TEMPLATE did not work
@ 2013-02-26 02:46  Ben Morrow <ben@morrow.me.uk>
  parent: mkumbale <mkumbale@gmail.com>
  1 sibling, 0 replies; 4+ messages in thread

From: Ben Morrow @ 2013-02-26 02:46 UTC (permalink / raw)
  To: pgsql-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



^ permalink  raw  reply  [nested|flat] 4+ messages in thread

* Re: Creating a new database with a TEMPLATE did not work
@ 2013-02-26 18:20  mkumbale <mkumbale@gmail.com>
  parent: Adrian Klaver <adrian.klaver@gmail.com>
  0 siblings, 0 replies; 4+ messages in thread

From: mkumbale @ 2013-02-26 18:20 UTC (permalink / raw)
  To: pgsql-sql

Adrian:

Thanks for the prompt reply.  I was able to create a new DB by renaming
Default to another name.  This was a carry over from our project which was
previously using SQLExpress.  

Thanks again for the reply.

Regards,
Murali



--
View this message in context: http://postgresql.1045698.n5.nabble.com/Creating-a-new-database-with-a-TEMPLATE-did-not-work-tp57466...
Sent from the PostgreSQL - sql mailing list archive at Nabble.com.


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



^ permalink  raw  reply  [nested|flat] 4+ messages in thread


end of thread, other threads:[~2013-02-26 18:20 UTC | newest]

Thread overview: 4+ messages (download: mbox mbox.gz follow: Atom feed)
-- links below jump to the message on this page --
2013-02-25 22:49 Creating a new database with a TEMPLATE did not work mkumbale <mkumbale@gmail.com>
2013-02-25 22:56 ` Adrian Klaver <adrian.klaver@gmail.com>
2013-02-26 18:20   ` mkumbale <mkumbale@gmail.com>
2013-02-26 02:46 ` Ben Morrow <ben@morrow.me.uk>

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