Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

enable_nullable选项没有起作用 #113

Closed
phaibin opened this issue Nov 15, 2019 · 4 comments
Closed

enable_nullable选项没有起作用 #113

phaibin opened this issue Nov 15, 2019 · 4 comments

Comments

@phaibin
Copy link

phaibin commented Nov 15, 2019

描述

不管把enable_nullable设为true或者false,含有NULL的insert语句都不能执行。
而且文档里面写enable_nullable默认是false,但是配置文件里面没有配置这个参数的情况下,inception show variables查询这个参数值为true

重现

INSERT INTO tickets (`id`, `status`) values (NULL, 2)

检测出现错误:

Column 'zuo.tickets.id' cannot be null in 1 row.

环境

数据库: mysql
版本: 5.6.39
goInception版本:1.1.3

参数

# IP地址
host = "0.0.0.0"
# 端口
port = 4000
# TiDB数据库目录
path = "/tmp/tidb"

[log]
# 日志级别: debug, info, warn, error, fatal.
level = "info"

# 日志格式, one of json, text, console.
format = "text"

# 禁用时间戳输出
disable-timestamp = false

# 日志文件
[log.file]
# 日志文件名
filename = ""
# 日志文件的最大上限(MB)
max-size = 300
# Max日志文件的保存天数,默认值 `0`,即不清理
max-days = 0
# 要保留的最大旧日志文件数,默认值 `0`,即不清理
max-backups = 0
# 日志轮询,默认值 `true`,即开启
log-rotate = true

[inc]

backup_host = "192.168.18.110"
backup_port = 3307
backup_user = "root"
backup_password = "123456"
max_update_rows = 10000000
check_primary_key = true
enable_blob_type = true
enable_identifer_keyword = true
enable_column_charset = true
enable_minimal_rollback = true

[osc]

osc_min_table_size = 0

[ghost]

ghost_on = true
ghost_aliyun_rds = true
ghost_allow_on_master = true
ghost_assume_rbr = true
ghost_approve_renamed_columns = true

[inc_level]
@hanchuanchuan
Copy link
Owner

如果列不允许为空的话,在insert时会自检测,不允许写入NULL值(这是数据库本身的强限制,无法跳过的,和审核选项无关)。
enable_nullable 的默认值是 true, 文档写错了。

@phaibin
Copy link
Author

phaibin commented Nov 17, 2019

INSERT INTO tickets (`id`, `status`) values (NULL, 2)

在这个SQL里面id为主键,这样写其实是让数据库自己生成主键,是允许的情况,在MySQL中直接执行都是可以通过的。这个错误确实是goInception抛出来的。

hanchuanchuan added a commit that referenced this issue Nov 18, 2019
fix: 修复非空字段insert审核时对自增列的处理 (#113)
@hanchuanchuan
Copy link
Owner

该问题已修复,已发布 V1.1.4

@phaibin
Copy link
Author

phaibin commented Nov 22, 2019

已修复,谢谢作者!

@phaibin phaibin closed this as completed Nov 22, 2019
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

No branches or pull requests

2 participants