Thread: is there a mysql to postgresql sql converter?
if so id like to see it/have it! if not is anyone interested in helping to make a script of some sort? toodles
On Mon, 14 Feb 2000, Clay wrote: > if so id like to see it/have it! > > if not is anyone interested in helping to make a script of some sort? In all generality, this is a rather complex issue: converting the database schemas (removing non-standard datatypes, such as enum), converting the queries, plus converting the C code. As I understand it, their C API uses some sort of "fetch next row" function, whereas we have a "get nth row" call. So you'd also have to change the program logic. And that covers only C, of course. Probably won't happen too soon. -- Peter Eisentraut Sernanders vaeg 10:115 peter_e@gmx.net 75262 Uppsala http://yi.org/peter-e/ Sweden
On Sat, 18 Nov 2000 01:13:23 +0200, Max Fonin said: > Can give a link ? > can do : http://freshmeat.net/projects/mysql2pgsql/?highlight=convert+sql i havent tried their's did try yours it was nice to have the transactions! > On Fri, 17 Nov 2000 13:45:37 -0800 > clayton cottingham <clayton@marketingchallenge.com> wrote: > > > Max Fonin wrote: > > > > > > Hi. > > > > > > I'm writing MySQL->Postgres dump converter. E.g. it will convert only database dumps produced by mysqldump. > > > It's almost ready, problems are ENUM and SET types. I have problems with types emulation. > > > Maybe someone help me guys ? > > > > > > Anyway, some half-working version attached. > > > > > > Max Rudensky. > > > > > > ------------------------------------------------------------------------ > > > Name: my2pg.pl > > > my2pg.pl Type: Perl Program (application/x-perl) > > > Encoding: base64 > > > > > > thats cool!! > > > > i thought i saw another converter in the last couple o months on > > freshmeat too > >
Hi. I'm writing MySQL->Postgres dump converter. E.g. it will convert only database dumps produced by mysqldump. It's almost ready, problems are ENUM and SET types. I have problems with types emulation. Maybe someone help me guys ? Anyway, some half-working version attached. Max Rudensky.
Attachment
Can give a link ? On Fri, 17 Nov 2000 13:45:37 -0800 clayton cottingham <clayton@marketingchallenge.com> wrote: > Max Fonin wrote: > > > > Hi. > > > > I'm writing MySQL->Postgres dump converter. E.g. it will convert only database dumps produced by mysqldump. > > It's almost ready, problems are ENUM and SET types. I have problems with types emulation. > > Maybe someone help me guys ? > > > > Anyway, some half-working version attached. > > > > Max Rudensky. > > > > ------------------------------------------------------------------------ > > Name: my2pg.pl > > my2pg.pl Type: Perl Program (application/x-perl) > > Encoding: base64 > > > thats cool!! > > i thought i saw another converter in the last couple o months on > freshmeat too
Max Fonin wrote: > > Hi. > > I'm writing MySQL->Postgres dump converter. E.g. it will convert only database dumps produced by mysqldump. > It's almost ready, problems are ENUM and SET types. I have problems with types emulation. > Maybe someone help me guys ? > > Anyway, some half-working version attached. > > Max Rudensky. > > ------------------------------------------------------------------------ > Name: my2pg.pl > my2pg.pl Type: Perl Program (application/x-perl) > Encoding: base64 thats cool!! i thought i saw another converter in the last couple o months on freshmeat too
Hi. > > Can give a link ? > can do : > http://freshmeat.net/projects/mysql2pgsql/?highlight=convert+sql Thank you. BTW, if you interested in this tool, I may send you fresh versions or place it on the web. Maybe you will or somebody help me with one problem ? Do you know PL/pgSQL and how to create new type in Postgres ? The problem is that I can't use new type constructed with CREATE TYPE if transform functions written on PL/pgSQL. Because PL/pgSQL doesn't support type "opaque", or I do something wrong. The same function on PL/pgSQL with input argtype "text" or "int2" works fine, but when I simply change argtype to "opaque", I get "compilation error near line0". Source is below. Thanks, Max Rudensky. BEGIN; CREATE FUNCTION enum_access_Monday_in (opaque)RETURNS enum_access_MondayAS 'DECLARE invalue ALIAS for $1;BEGIN IF invalue=''''OR invalue=''0'' THEN RETURN 0; END IF; IF invalue=''Monday'' OR invalue=''1'' THEN RETURN 1; END IF; IFinvalue=''Tuesday'' OR invalue=''2'' THEN RETURN 2; END IF; IF invalue=''Wednesday'' OR invalue=''3'' THEN RETURN 3;END IF; RAISE EXCEPTION ''incorrect input value: %'',invalue;END;'LANGUAGE 'plpgsql'WITH (ISCACHABLE); CREATE FUNCTION enum_access_Monday_out (opaque)RETURNS opaqueAS 'DECLARE outvalue ALIAS for $1;BEGIN IF outvalue=0THEN RETURN ''''; END IF; IF outvalue=1 THEN RETURN ''Monday''; END IF; IF outvalue=2 THEN RETURN ''Tuesday'';END IF; IF outvalue=3 THEN RETURN ''Wednesday''; END IF; RAISE EXCEPTION ''incorrect output value: %'',outvalue;END;'LANGUAGE'plpgsql'WITH (ISCACHABLE); CREATE TYPE enum_access_Monday (internallength = 2,input = enum_access_Monday_in,output = enum_access_Monday_out,PASSEDBYVALUE ); COMMIT;
Hi. MySQL->Postgres dump converter is now available at http://ziet.zhitomir.ua/~fonin/code/my2pg.pl. Still beta and bugsome version but working, supports MySQL ENUMs, near the end are SET emulation. Please help me to test. Max Rudensky.
FYI, 7.1 will have a MySQL dump converter in /contrib. [ Charset ISO-8859-1 unsupported, converting... ] > > On Sat, 18 Nov 2000 01:13:23 +0200, Max Fonin said: > > > Can give a link ? > > > > can do : > http://freshmeat.net/projects/mysql2pgsql/?highlight=convert+sql > > i havent tried their's > > did try yours > > it was nice to have the transactions! > > > > > On Fri, 17 Nov 2000 13:45:37 -0800 > > clayton cottingham <clayton@marketingchallenge.com> wrote: > > > > > Max Fonin wrote: > > > > > > > > Hi. > > > > > > > > I'm writing MySQL->Postgres dump converter. E.g. it will convert only database dumps produced by mysqldump. > > > > It's almost ready, problems are ENUM and SET types. I have problems with types emulation. > > > > Maybe someone help me guys ? > > > > > > > > Anyway, some half-working version attached. > > > > > > > > Max Rudensky. > > > > > > > > ------------------------------------------------------------------------ > > > > Name: my2pg.pl > > > > my2pg.pl Type: Perl Program (application/x-perl) > > > > Encoding: base64 > > > > > > > > > thats cool!! > > > > > > i thought i saw another converter in the last couple o months on > > > freshmeat too > > > > > > -- Bruce Momjian | http://candle.pha.pa.us pgman@candle.pha.pa.us | (610) 853-3000+ If your life is a hard drive, | 830 Blythe Avenue + Christ can be your backup. | Drexel Hill, Pennsylvania19026
FYI, we have a MySQL Perl script in 7.1beta. Would you please check that and see if you have any enhancements? Thanks. > Hi. > > MySQL->Postgres dump converter is now available at > http://ziet.zhitomir.ua/~fonin/code/my2pg.pl. Still beta and > bugsome version but working, supports MySQL ENUMs, near the end > are SET emulation. Please help me to test. > > Max Rudensky. > -- Bruce Momjian | http://candle.pha.pa.us pgman@candle.pha.pa.us | (610) 853-3000 + If your life is a hard drive, | 830 Blythe Avenue + Christ can be your backup. | Drexel Hill, Pennsylvania 19026