Re: MySQL to Postgres question

Поиск
Список
Период
Сортировка
От Tom Lane
Тема Re: MySQL to Postgres question
Дата
Msg-id 24780.1206117269@sss.pgh.pa.us
обсуждение исходный текст
Ответ на MySQL to Postgres question  ("Edward Blake" <comedian.watchman@gmail.com>)
Список pgsql-general
"Edward Blake" <comedian.watchman@gmail.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

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

Предыдущее
От: Craig Ringer
Дата:
Сообщение: Re: deadlock error messages
Следующее
От: Andreas Kretschmer
Дата:
Сообщение: Re: Table size