You are viewing a plain text version of this content. The canonical link for it is here.
Posted to notifications@shardingsphere.apache.org by GitBox <gi...@apache.org> on 2019/08/05 07:54:35 UTC
[GitHub] [incubator-shardingsphere] archerForzmy opened a new issue #2810:
sharding-proxy run insert sql show exception
archerForzmy opened a new issue #2810: sharding-proxy run insert sql show exception
URL: https://github.com/apache/incubator-shardingsphere/issues/2810
```
INSERT INTO undo_log ( branch_id, xid, context, rollback_info, log_status, log_created, log_modified )
VALUES
( 2018714708, '192.168.32.2:8091:2018714707', 'serializer=jackson', '{}', 1, now(), now() )
```
Execute in a separate mysql, no problem!
Execute in a sharding proxy, the following exceptions occur!
> 1292 - Data truncation: Incorrect datetime value: 'now()' for column 'log_created' at row 1
Here I provide the piecewise table structure.
```
CREATE TABLE `undo_log` (
`id` bigint(20) NOT NULL AUTO_INCREMENT,
`branch_id` bigint(20) NOT NULL,
`xid` varchar(100) NOT NULL,
`context` varchar(128) NOT NULL,
`rollback_info` longblob NOT NULL,
`log_status` int(11) NOT NULL,
`log_created` datetime NOT NULL,
`log_modified` datetime NOT NULL,
`ext` varchar(100) DEFAULT NULL,
PRIMARY KEY (`id`),
UNIQUE KEY `ux_undo_log` (`xid`,`branch_id`)
) ENGINE=InnoDB AUTO_INCREMENT=5 DEFAULT CHARSET=utf8;
```
I followed it up and found some problems.
Sharding-proxy translates the insert statement into the following statement and sends it to MySQL for execution
```
INSERT INTO undo_log ( branch_id, xid, context, rollback_info, log_status, log_created, log_modified )
VALUES
( 2018714708, '192.168.32.2:8091:2018714707', 'serializer=jackson', '{}', 1, 'now()', 'now()' )
```
The problem arises with functions with single quotes!!!
----------------------------------------------------------------
This is an automated message from the Apache Git Service.
To respond to the message, please log on to GitHub and use the
URL above to go to the specific comment.
For queries about this service, please contact Infrastructure at:
users@infra.apache.org
With regards,
Apache Git Services