Re: CREATE DATABASE question.

Поиск
Список
Период
Сортировка
От Eric Faulhaber
Тема Re: CREATE DATABASE question.
Дата
Msg-id 44C80326.5030909@goldencode.com
обсуждение исходный текст
Ответ на CREATE DATABASE question.  ("Karen Hill" <karen_hill22@yahoo.com>)
Список pgsql-general
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


В списке pgsql-general по дате отправления:

Предыдущее
От: aurora
Дата:
Сообщение: Re: Database corruption with Postgre 7.4.2 on FreeBSD 6.1?
Следующее
От: "Aaron Glenn"
Дата:
Сообщение: Re: Database corruption with Postgre 7.4.2 on FreeBSD 6.1?