Jump to content


Photo

postgre to mysql conversion


  • Please log in to reply
2 replies to this topic

#1 spc_123

spc_123
  • New Members
  • Pip
  • Newbie
  • 2 posts

Posted 24 August 2003 - 12:28 AM

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

#2 Barand

Barand
  • Moderators
  • Sen . ( ile || sei )
  • 18,017 posts

Posted 26 August 2003 - 08:00 AM

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
If you are still using mysql_ functions, STOP! Use mysqli_ or PDO. The longer you leave it the more you will have to rewrite.

Donations gratefully received






moon.png

|baaGrid| easy data tables - and more
|baaChart| easy line, column and pie charts

#3 spc_123

spc_123
  • New Members
  • Pip
  • Newbie
  • 2 posts

Posted 26 August 2003 - 01:53 PM

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




0 user(s) are reading this topic

0 members, 0 guests, 0 anonymous users