Search Postgresql Archives

Re: MySQL to Postgres question

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

 



-----BEGIN PGP SIGNED MESSAGE-----
Hash: SHA1

On Fri, 21 Mar 2008 12:15:05 -0400
"Edward Blake" <comedian.watchman@xxxxxxxxx> wrote:

> 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?

http://www.postgresql.org/docs/8.3/static/sql-createtable.html

I have no idea what KEY means in MySQL. Is it supposed to create an
INDEX? If so, you will need to create the indexes (not including the
PRIMARY KEY) after you create the table.

And just a quick editor view, you spelled description incorrectly in
product_descrition and your product_id is your primary key so you don't
have to set it NOT NULL.

Joshua D. Drake



- -- 
The PostgreSQL Company since 1997: http://www.commandprompt.com/ 
PostgreSQL Community Conference: http://www.postgresqlconference.org/
United States PostgreSQL Association: http://www.postgresql.us/
Donate to the PostgreSQL Project: http://www.postgresql.org/about/donate


-----BEGIN PGP SIGNATURE-----
Version: GnuPG v1.4.6 (GNU/Linux)

iD8DBQFH4+GiATb/zqfZUUQRAqnnAJ424OFzGg23QFyKEy+MuiAVii02MQCfZL6Z
grPtt4bz9bwTcQYBgiuPTQM=
=U4S5
-----END PGP SIGNATURE-----

-- 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