Jump to content

postgre to mysql conversion


spc_123

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

Link to comment
https://forums.phpfreaks.com/topic/935-postgre-to-mysql-conversion/
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

Archived

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

×
×
  • Create New...

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.