On Mon, Apr 27, 2009 at 03:13:09PM +0200, Matej Hasul wrote:
> Hello, I started working on migrating tables to mysql.
> 
> Data types conversion looks like this:
> 
> varchar2 -> varchar
> number -> numeric
> date -> timestamp
> 
> Following problems emerged:
> 1. Mysql doesn`t support user defined data type. So I have no idea what to
> do with evr_t.

Please check what the deal with evr_t in PostgreSQL port was. IIRC,
the type is used for collation and presentation, so you should be able
to replace it with plain table and a couple of functions.

> 2. Mysql doesn`t support nested tables. For example something like "create
> or replace type channel_name_t as table of varchar(64)". Does anyone know
> some workaround?

Check if that type is needed at all. Looking around the source code,
it is only used in the channel_name_join function, and that one does
not seem to be called anywhere. So it both looks like a dead code to
me, which should be removed from the Oracle schema as well.

> 3. Check constraint not working. According to mysql documentation - "The
> CHECK clause is parsed but ignored by all storage engines".
> Workaround: Use before-insert-or-update trigger to implement check
> constraint.

OK.

> 4. Create table test(date1 date default (sysdate), date2 date default
> (sysdate)) will not work in mysql, because there can be only one date column
> with default clause.
> Workaround: Use before-insert-or-update trigger to set actual date(s).

OK.

> 5. Missing sequence in mysql.
> Workaround: One option is to use AUTO_INCREMENT and LAST_INSERT_ID().
> Another option is to create table holding sequence number and create
> procedures curval('seq_name') and nextval('seq_name').

With the table-holding-sequence-values approach (and I'm not sure
about the first one), keep in mind that it will be
transaction-aware -- if you rollback, you will get the same value next
time. That might or might not be a problem. Also, for the same reason,
the sessions will likely serialize on that table.

-- 
Jan Pazdziora
Senior Software Engineer, Satellite Engineering, Red Hat

_______________________________________________
Spacewalk-devel mailing list
[email protected]
https://www.redhat.com/mailman/listinfo/spacewalk-devel

Reply via email to