Re: creating tables using a file

Поиск
Список
Период
Сортировка
От Craig Ringer
Тема Re: creating tables using a file
Дата
Msg-id 499275A6.2090800@postnewspapers.com.au
обсуждение исходный текст
Ответ на creating tables using a file  (Kusuma Pabba <kusumap@ncoretech.com>)
Список pgsql-general
Kusuma Pabba wrote:
> hello all,
>    i have used a file containing all the queries and directly executed
> the file  to create tables in mysql, now i want to use the same for psql
> is it
> possible?

psql -f filename.sql

> Do i need to make any changes to the file?

Lots. PostgreSQL and MySQL have quite significantly different SQL
dialects, and even where they support the same syntax the semantic
meaning may not be exactly the same.

You will need to correct for things like use of MySQL "AUTO_INCREMENT"
fields. PostgreSQL doesn't have that at all, it uses transaction-safe
sequences (and the SERIAL helper pseudo-type) instead. The behaviour is
different, and there is no exact equivalent for AUTO_INCREMENT. For good
reasons, as there are lots of problems with AUTO_INCREMENT, but it does
complicate porting schema.

There are lots of other differences, too. Tools do exist to convert
MySQL schema to PostgreSQL syntax and adjust for common differences, but
I'm not sure how effective they really are.

--
Craig Ringer

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

Предыдущее
От: Craig Ringer
Дата:
Сообщение: Re: 'text' is gone?
Следующее
От: John R Pierce
Дата:
Сообщение: Re: Intel SSD