Re: Migrate from MySQL to PostgreSQL
| From: | Martín Marqués | Date: | Fri, 23 Jan 2004 14:02:00 +0000 |
| Subject: | Re: Migrate from MySQL to PostgreSQL | ||
| References: | 1 2 3 4 5 6 7 | Groups: | php.pear.general |
| Request: | Send a blank email to pear-general+get-10327@lists.php.net to get a copy of this message | ||
Mensaje citado por Andreas Korthaus <akorthaus@web.de>:
> > you may have to set the sequence format in case you were using a
> > different one from the standard format.
>
> I use "nextSequence()" Methode in PEAR::DB, and this creates the
nextSequence doesn't exist in PEAR::DB. What you have is nextId() which in
mysql.php says this:
// }}}
// {{{ nextId()
/**
* Get the next value in a sequence. We emulate sequences
* for MySQL. Will create the sequence if it does not exist.
*
* @access public
*
* @param string $seq_name the name of the sequence
*
* @param bool $ondemand whether to create the sequence table on demand
* (default is true)
*
* @return mixed a sequence integer, or a DB error
*/
As you see it's emulated inside a table, while in PostgreSQL (pgsql.php) it works
like this:
/**
* Get the next value in a sequence.
*
* We are using native PostgreSQL sequences. If a sequence does
* not exist, it will be created, unless $ondemand is false.
*
* @access public
* @param string $seq_name the name of the sequence
* @param bool $ondemand whether to create the sequence on demand
* @return a sequence integer, or a DB error
*/
As you see, switching is trivial if you go from MySQL to PostgreSQL, just because
those tables are no longer usefull (just be sure you get the values stored there
and put them in the sequeces that PG creates). After that, just DROP the tables.
--
select 'mmarques' || '@' || 'unl.edu.ar' AS email;
-------------------------------------------------------
Martín Marqués | Programador, DBA
Centro de Telemática | Administrador
Universidad Nacional
del Litoral
-------------------------------------------------------