Re: creating tables using a file

From: Craig Ringer <craig(at)postnewspapers(dot)com(dot)au>
To: Kusuma Pabba <kusumap(at)ncoretech(dot)com>
Cc: pgsql-general(at)postgresql(dot)org
Subject: Re: creating tables using a file
Date: 2009-02-11 06:52:22
Message-ID: 499275A6.2090800@postnewspapers.com.au
Views: Raw Message | Whole Thread | Download mbox | Resend email
Thread:
Lists: 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

In response to

Browse pgsql-general by date

  From Date Subject
Next Message John R Pierce 2009-02-11 06:55:58 Re: Intel SSD
Previous Message Craig Ringer 2009-02-11 06:46:00 Re: 'text' is gone?