Unable to create PostgreSQL database

PostgreSQL is the database server used to store information. Do you have a question or are you having problem with PostgreSQL? If so, post them here.

Moderator: Moderators

Re: Unable to create PostgreSQL database

Postby advis0r » Tue Feb 05, 2008 11:07 am

i uninstalled my old postgresql and now installed the 8.3 final version that came out yesterday.

getting the same problem:
[codek0d]2008/02/05 15:58:52.234: [- Main -][PostgresConnection (Error)] Unable to execute query: CREATE DATABASE "PT3_beta3" WITH TEMPLATE = template0 ENCODING = 'SQL_ASCII'; ALTER DATABASE "PT3_beta3" OWNER TO postgres;; Reason: Fatal Error (ERROR: CREATE DATABASE cannot be executed from a function or multi-command string )[/codek0d]

maybe do "create database" and "alter database" in two seperate statements?

or use the same single-statement syntax that pgAdmin uses when creating a new database
[codek0d]CREATE DATABASE test
WITH OWNER = postgres
ENCODING = 'UTF8';[/codek0d]

and add the TEMPLATE thing ;)
advis0r
 
Posts: 137
Joined: Thu Jan 24, 2008 8:39 pm
Location: Southern Germany

Re: Unable to create PostgreSQL database

Postby Josh » Tue Feb 05, 2008 11:11 am

We will be doing tests with PostgreSQL 8.3 to make PT3 compatible with it. I'd recommend waiting until we are able to do this before upgrading yourself.
Josh
Site Admin
 
Posts: 6222
Joined: Sat Dec 08, 2007 6:03 pm

Re: Unable to create PostgreSQL database

Postby advis0r » Tue Feb 05, 2008 11:14 am

[quote="Josh"27p]We will be doing tests with PostgreSQL 8.3 to make PT3 compatible with it. I'd recommend waiting until we are able to do this before upgrading yourself.[/quote27p]

thx for the hint ... :P

did you read my whole post?

[code27p]CREATE DATABASE cannot be executed from a function or multi-command string[/code27p]
so use the right syntax!
advis0r
 
Posts: 137
Joined: Thu Jan 24, 2008 8:39 pm
Location: Southern Germany

Re: Unable to create PostgreSQL database

Postby Josh » Tue Feb 05, 2008 11:49 am

Yes, I read your post. I am using the correct syntax, it's just that 8.3 isn't accepting it. We will need to find out why.
Josh
Site Admin
 
Posts: 6222
Joined: Sat Dec 08, 2007 6:03 pm

Re: Unable to create PostgreSQL database

Postby advis0r » Tue Feb 05, 2008 12:42 pm

this is the correct syntax:

[codej0w]CREATE DATABASE "PT3_beta3"
WITH OWNER = postgres
TEMPLATE = template0
ENCODING = 'SQL_ASCII';[/codej0w]

http://www.postgresql.org/docs/8.3/inte ... abase.html

i tried it in the psql console of my 8.3 installation and it works.

PT beta3 seems to be using two seperate statements:
[codej0w]CREATE DATABASE "PT3_beta3" WITH TEMPLATE = template0 ENCODING = 'SQL_ASCII';
ALTER DATABASE "PT3_beta3" OWNER TO postgres;[/codej0w]

are you sure that this is not the reason for this error?
advis0r
 
Posts: 137
Joined: Thu Jan 24, 2008 8:39 pm
Location: Southern Germany

Re: Unable to create PostgreSQL database

Postby Josh » Tue Feb 05, 2008 12:44 pm

I'm not disagreeing with you that the problem is with the way PT3 is doing it.
Josh
Site Admin
 
Posts: 6222
Joined: Sat Dec 08, 2007 6:03 pm

Re: Unable to create PostgreSQL database

Postby APerfect10 » Tue Feb 05, 2008 1:21 pm

Its not the syntax its the method of sending the queries to the database. This will be resolved in the next beta release. Furthermore, I am [bw0h][iw0h]hoping[/iw0h][/bw0h] to have 8.3 available for new installations in beta 4.

Best regards,

Derek
APerfect10
Site Admin
 
Posts: 4464
Joined: Sat Dec 08, 2007 6:03 pm

Re: Unable to create PostgreSQL database

Postby wwonka » Tue Feb 05, 2008 5:49 pm

Question I did the syntax and created the database. but it still cant find it in the directory.

Where is the PT database supposed to be?

I am usining 8.3



postgres=# ALTER DATABASE "PT3_beta3" OWNER TO postgres;
ALTER DATABASE
postgres=# CREATE DATABASE "PT3_beta3" WITH TEMPLATE = template0 ENCODING = 'SQL
_ASCII';
ERROR: database "PT3_beta3" already exists
postgres=#
wwonka
 
Posts: 7
Joined: Mon Feb 04, 2008 9:26 pm

Re: Unable to create PostgreSQL database

Postby APerfect10 » Tue Feb 05, 2008 6:05 pm

[quote="wwonka"vmx]Question I did the syntax and created the database. but it still cant find it in the directory.

Where is the PT database supposed to be?

I am usining 8.3

postgres=# ALTER DATABASE "PT3_beta3" OWNER TO postgres;
ALTER DATABASE
postgres=# CREATE DATABASE "PT3_beta3" WITH TEMPLATE = template0 ENCODING = 'SQL
_ASCII';
ERROR: database "PT3_beta3" already exists
postgres=#[/quotevmx]

That simply creates a blank database. You will need to execute the query to create the schema for PT3 then under Database->Database Management, you will need to enter the database name and check "This is an existing database".

Running the schema may be a little advanced. We will be releasing beta 4 within the next few days which will support PostgreSQL 8.3. I advise waiting for this release.

Best regards,

Derek
APerfect10
Site Admin
 
Posts: 4464
Joined: Sat Dec 08, 2007 6:03 pm

Previous

Return to PostgreSQL [Read Only]

Who is online

Users browsing this forum: No registered users and 13 guests

cron
highfalutin