Re: Migrate from MySQL to PostgreSQL
| From: | Martín Marqués | Date: | Fri, 23 Jan 2004 13:06:59 +0000 |
| Subject: | Re: Migrate from MySQL to PostgreSQL | ||
| References: | 1 2 3 4 | Groups: | php.pear.general |
| Request: | Send a blank email to pear-general+get-10320@lists.php.net to get a copy of this message | ||
Mensaje citado por Alexey Borzov <borz_off@cs.msu.su>:
> Hi!
>
> >
> > CREATE TABLE mySequence_seq (
> > id int(10) unsigned NOT NULL,
> > PRIMARY KEY (id)
> > ) TYPE=MyISAM;
> >
> > my2pg.pl translates this as followed:
> >
> >
> > CREATE SEQUENCE mysequence_seq_id_seq;
> >
> > CREATE TABLE "mySequence_seq" (
> > "id" INT4 DEFAULT nextval('mysequence_seq_id_seq'),
> > PRIMARY KEY ("id")
> >
> > );
> >
> > Is that correct - or how should I migrate the max-IDs of my sequences?
>
> PEAR::DB uses native PostgreSQL sequences, so you should do
>
> CREATE SEQUENCE mysequence_seq;
>
> SELECT setval('mysequence_seq', /* here goes max value from MySQL's
> "sequence" table */);
Don't confuse the boy. :-)
I think he is saying "where can I get the last value that MySQL inserted to an
autoincremental field". That value is in the sequence.
What Andreas was showing you was how to set the maximun value of your sequence
(after that it will by default roll back to the inicial value).
I do think like Andreas that you will need to edit the SQL file by hand in many
parts, but I think the sequence table is useless on PostgreSQL.
Good luck.
--
select 'mmarques' || '@' || 'unl.edu.ar' AS email;
-------------------------------------------------------
Martín Marqués | Programador, DBA
Centro de Telemática | Administrador
Universidad Nacional
del Litoral
-------------------------------------------------------