Search Postgresql Archives

Re: creating tables using a file

[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]

 



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

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

[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]
[Index of Archives]     [Postgresql Jobs]     [Postgresql Admin]     [Postgresql Performance]     [Linux Clusters]     [PHP Home]     [PHP on Windows]     [Kernel Newbies]     [PHP Classes]     [PHP Books]     [PHP Databases]     [Postgresql & PHP]     [Yosemite]
  Powered by Linux