Re: MySQL to Postgres question

From: Tom Lane <tgl(at)sss(dot)pgh(dot)pa(dot)us>
To: "Edward Blake" <comedian(dot)watchman(at)gmail(dot)com>
Cc: pgsql-general(at)postgresql(dot)org
Subject: Re: MySQL to Postgres question
Date: 2008-03-21 16:34:29
Message-ID: 24780.1206117269@sss.pgh.pa.us
Views: Raw Message | Whole Thread | Download mbox | Resend email
Thread:
Lists: pgsql-general

"Edward Blake" <comedian(dot)watchman(at)gmail(dot)com> writes:
> When I try and rewrite it as a Postgres statement (below), it fails at line
> 9.
> 0 SET CONSTRAINTS ALL DEFERRED;

I don't think that does the same thing as mysql's foreign_key_checks = 0.

> 2 product_id serial[11] not null,

This is trying to create an array, it is not at all the same as integer(11).
All of your other uses of square brackets are wrong too. The varchars
will be okay with (255) but you should just drop the (11)'s --- use
either plain integer or bigint depending on what range you need.

> 9 KEY class_id (class_id),

PG doesn't have this type of clause within CREATE TABLE. To create
a non-unique index you need a separate CREATE INDEX statement, eg

CREATE INDEX products_class_id ON products(class_id);

regards, tom lane

In response to

Browse pgsql-general by date

  From Date Subject
Next Message Andreas Kretschmer 2008-03-21 16:42:18 Re: Table size
Previous Message Craig Ringer 2008-03-21 16:33:05 Re: deadlock error messages