Re: [GENERAL] CREATE DATABASE question.

2006-07-26 Thread Eric Faulhaber
Karen Hill wrote:
> I have an sql file that doesn' t work properly when I do: psql <
> mysql.sql .  I cannot get it to connect to the database.
> 
> Here what I'd like it to do:
> 
> CREATE DATABASE testdb;
> \c testdb;
> CREATE TABLE tableTest(var varchar);
> 
> But I get an error on the second line about an invalid character.  Is
> it even possible to connect to a different db when giving an sql file
> to psql to process?

Sure, just lose the trailing semi-colon from your connect command, as in:

CREATE DATABASE testdb;
\c testdb
CREATE TABLE tableTest(var varchar);

This lets psql interpret your connect request as a psql command instead
of as an SQL statement.

Regards,
Eric Faulhaber


---(end of broadcast)---
TIP 1: if posting/reading through Usenet, please send an appropriate
   subscribe-nomail command to [EMAIL PROTECTED] so that your
   message can get through to the mailing list cleanly


[GENERAL] CREATE DATABASE question.

2006-07-26 Thread Karen Hill
I have an sql file that doesn' t work properly when I do: psql <
mysql.sql .  I cannot get it to connect to the database.

Here what I'd like it to do:

CREATE DATABASE testdb;
\c testdb;
CREATE TABLE tableTest(var varchar);

But I get an error on the second line about an invalid character.  Is
it even possible to connect to a different db when giving an sql file
to psql to process?

regards,


---(end of broadcast)---
TIP 3: Have you checked our extensive FAQ?

   http://www.postgresql.org/docs/faq