Jump to content

Archived

This topic is now archived and is closed to further replies.

spc_123

postgre to mysql conversion

Recommended Posts

I know of a mysql to postgre conversion, but not the other way around. I have syntax that I\'d like to modify for mysql as follows:

***********************************************************************

CREATE SEQUENCE \"users_userid_seq\" start 1 increment 1 maxvalue 2147483647 minvalue 1 cache 1;

 

--

-- TOC Entry ID 4 (OID 215214)

--

-- Name: stocks_stock_id_seq Type: SEQUENCE Owner: postgres

--

 

CREATE SEQUENCE \"stocks_stock_id_seq\" start 1 increment 1 maxvalue 2147483647 minvalue 1 cache 1;

 

--

-- TOC Entry ID 42 (OID 215216)

--

-- Name: stocks Type: TABLE Owner: postgres

--

 

CREATE TABLE \"stocks\" (

\"stock_id\" integer DEFAULT nextval(\'\"stocks_stock_id_seq\"\'::text) NOT NULL,

\"userid\" integer NOT NULL,

\"symbol\" character varying(4) NOT NULL,

Constraint \"stocks_pkey\" Primary Key (\"stock_id\")

************************************************************************

It\'s getting hung on the \"CREATE SEQUENCE.\" Thanks in advance

Share this post


Link to post
Share on other sites

I don\'t know postgresql but it looks as thought it is auto-generating the the next id. Try this in mySQl to get same result :

 


CREATE TABLE `stocks` ( 

`stock_id` integer  NOT NULL auto_increment, 

`userid` integer NOT NULL, 

`symbol` varchar(4) NOT NULL, 

Primary Key (stock_id) )

 

hth

Share this post


Link to post
Share on other sites

Thanks for the suggestions...actually, I found that the beta version of issue-tracker has a utility that can convert PostgreSQL to MySQL and back. Seems to work very well...Thanks again

Share this post


Link to post
Share on other sites

×

Important Information

We have placed cookies on your device to help make this website better. You can adjust your cookie settings, otherwise we'll assume you're okay to continue.