达梦数据类型转换异常

总之,大盟数据类型转换异常的原因有两个。
字段类型混淆或字符串格式错误。
去年我们运行这个项目时,有一个老家伙很震惊,因为他在字符串中使用了带引号的数字作为整数。
当他看到错误信息时,愣住了。
我们先来说说最重要的事情。
大梦对类型非常敏感。
例如,在本例中,ID 显然是一个字符串,但 SQL 将其视为数字。
转换后它立即崩溃。
请使用单引号。
还有一点是,迁移数据时需要更加小心。
例如,从 PostgreSQL 迁移到 Dameng 时,text 到 varchar 的转换可能会失败。
起初我以为删除和重建就足够了,但后来我发现我需要先清除数据才能做其他事情。
否则,仍然会报告类型冲突。
等等,还有一件事。
如果您发现您的表结构没有类型,请不要做出假设。
请在 DMV View 上进行检查并确认。
老实说,这很令人困惑。
我们建议执行两次此操作,尤其是在条件语句中使用字段类型之前。

MYSQL-5.7与达梦数据库(DM-DM8)的区别

前几天在调试一个项目,突然发现SQL语句在MySQL 5 .7 上跑得很快,但是到了大梦DM8 就好像卡住了,终止了。
This got me thinking about the difference between the two.
Let's talk about something a little different first. When I wrote a query before, MySQL used IDENTITY as the field name, and added double quotes. Because of this, an "invalid column name" error is automatically reported when porting to DM8 . You should use "Add it. This list is very annoying. MySQL uses backslashes arbitrarily, but DM recognizes double quotes."
There are also string functions. MySQL's GROUP_CONCAT should never be used in DM, and should be replaced by wm_concat. I've tested GROUP_CONCAT on MySQL 5 .7 and it returns results in minutes, but it takes half a day to convert to DM8 . The same is true for date format. MySQL's DATE_FORMAT(now(), '%Y-%m-%d2 3 :5 9 :5 9 ') explodes on DM and needs to be converted to %Y-%m-%d%H:%i:%s. This reminds me of the last time I was at a customer site, an old employee struggled with a date format issue for two whole days.
DM saves you trouble with data types. MySQL TINYBLOB and LONGBLOB have no trace on DM. However, DM IDENTITY is simpler than MySQL AUTO_INCREMENT, which is very convenient. However, I recently met someone who uses CASE WHEN. DM doesn't actually support conditional statements like >=. Value > 0 then it should be written as case.... I'm not really used to this writing method.
DM is a bit confused about the connection configuration. Druid's WallFilter firewall filter does not work on DM and can only be bypassed by changing the code manually. A friend of mine, while working on a project, rewrote half of the filter to make it compatible with DM. The final code was longer than the first version.
等等,还有一件事。
I have noticed that DM8 time functions seem to be more "tight" than MySQL 5 .7 . The last time I tried the DATE_ADD function, MySQL accepted a numeric interval of DATE_ADD('2 02 3 -01 -01 ', INTERVAL 1 YEAR 2 MONTH). As a result, DM is disabled. This reminds me of a reporting tool I wrote about before. To be compatible with DM, the timing section has been updated three times.
Now I think if someone is used to using MySQL and suddenly wants to switch to DM, he should re-examine all SQL. Especially for reserved words used as field names, MySQL still他可以躲开后面的孩子,但DM却无能为力。
这突然让我觉得数据库迁移比预想的还要复杂。

达梦json值会因罕见汉字报错

Dameng JSON may have problems when dealing with rare Chinese characters.
字符集编码是关键。
Check the character set encoding to ensure that rare Chinese characters are supported.
JSON 以 VARCHAR 或 TEXT 格式存储。
Judging by the storage method, it is suitable for processing Chinese characters.
It is necessary to check the compatibility of the configuration. JSON_MODE 设置影响解析。

Character set encoding, storage method, configuration compatibility. 看看这三个地方。

If this still does not work, please contact Dameng technical support.