Re: MySQL to Postgres question - Mailing list pgsql-general

From Rodrigo Gonzalez
Subject Re: MySQL to Postgres question
Date
Msg-id 47E3E27F.4050400@gmail.com
Whole thread Raw
In response to MySQL to Postgres question  ("Edward Blake" <comedian.watchman@gmail.com>)
List pgsql-general
Edward Blake escribió:
> The table I have in MySQL is similar to below:
>
>  0 SET FOREIGN_KEY_CHECKS=0;
>  1 CREATE TABLE products (
>  2     product_id integer(11) not null auto_increment,
>  3     product_name varchar(255) not null,
>  4     product_descrition varchar(255) not null,
>  5     class_id integer(11) not null,
>  6     subclass_id integer(11) not null,
>  7     department_id integer(11) not null
>  8     PRIMARY KEY (product_id),
>  9     KEY class_id (class_id),
> 10     KEY subclass_id (subclass_id),
> 11     KEY department_id (department_id)
> 12 );
>
> When I try and rewrite it as a Postgres statement (below), it fails at
> line 9.
>  0 SET CONSTRAINTS ALL DEFERRED;
>  1 CREATE TABLE products (
>  2      product_id serial[11] not null,
>  3      product_name varchar[255] not null,
>  4      product_descrition varchar[255] not null,
>  5      class_id integer[11] not null,
>  6      subclass_id integer[11] not null,
>  7      department_id integer[11] not null
>  8      PRIMARY KEY (product_id),
>  9      KEY class_id (class_id),
> 10      KEY subclass_id (subclass_id),
> 11      KEY department_id (department_id)
> 12 );
>
> Any ideas?
CREATE TABLE products (
product_id serial not null,
product_name varchar(255) not null,
product_description varchar(255) not null,
class_id integer not null,
subclass_id integer not null,
department_id integer not null,
PRIMARY KEY (product_id)
);

CREATE INDEX idx_prod_class_id ON products (class_id);
CREATE INDEX idx_prod_subclass_id ON products (subclass_id);
CREATE INDEX idx_prod_department_id ON products (department_id);



Attachment

pgsql-general by date:

Previous
From: Andreas 'ads' Scherbaum
Date:
Subject: Re: MySQL to Postgres question
Next
From: Steve Clark
Date:
Subject: Re: ecpg program getting stuck