Matej Hasul wrote:
Hello, I started working on migrating tables to mysql.
Data types conversion looks like this:
varchar2 -> varchar
number -> numeric
date -> timestamp
For the records. Matej is trying to rewrite queries in run time to be
MySQL compatible...
Following problems emerged:
1. Mysql doesn`t support user defined data type. So I have no idea what
to do with evr_t.
map it to different table? I.e change evr_t to integer and use it as
look up value to table EVR with columns epoch, version, release and
queries which use it expand to join with this table?
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?
The same, leave it as normal table and join it with original in runtime.
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.
If possible. But I think we can live without these constraints. Whover
will use mysql can not have the same data consistency as in Oracle or
PostgreSQL by definition.
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).
Err. There can be more default columt with date. But the value have to
be constant, not the function.
Yeah, trigger can fix it.
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').
I think AUTO_INCREMENT and LAST_INSERT_ID() meets our needs.
But yeah, creating table which hold the sequence better map to sequence
as we all know it. But remember that it can not be table which support
transaction, otherwise you will be recycling the numbers from sequence.
--
Miroslav Suchy
Red Hat Satellite Engineering
_______________________________________________
Spacewalk-devel mailing list
[email protected]
https://www.redhat.com/mailman/listinfo/spacewalk-devel