You signed in with another tab or window. Reload to refresh your session.You signed out in another tab or window. Reload to refresh your session.You switched accounts on another tab or window. Reload to refresh your session.Dismiss alert
MySQL allows you to specify an INSERT with empty VALUES as long as all columns have a valid default. For example, the following is valid:
mysql> CREATE TABLE customer (
id INT UNSIGNED NOT NULL AUTO_INCREMENT PRIMARY KEY,
name VARCHAR(255),
description VARCHAR(255)
);
Query OK, 0 rows affected (0.03 sec)
mysql>INSERT INTO customer () VALUES ();
Query OK, 1 row affected (0.01 sec)
mysql>SELECT*FROM customer;
+----+------+-------------+
| id | name | description |
+----+------+-------------+
| 1 | NULL | NULL |
+----+------+-------------+1 row inset (0.00 sec)
But the following is not:
mysql> CREATE TABLE customer (
id INT UNSIGNED NOT NULL AUTO_INCREMENT PRIMARY KEY,
name VARCHAR(255) NOT NULL,
description VARCHAR(255)
);
Query OK, 0 rows affected (0.03 sec)
mysql>INSERT INTO customer () VALUES ();
ERROR 1364 (HY000): Field 'name' doesn't have a default value
Connected to Vitess, we get a syntax error with the same INSERT:
ERROR 1105 (HY000): vtgate: http://mc-test1-mc1local-vtgate-afe64d24-747ddd7f88-mmd45:15000/: syntax error at position 24
Reproduction Steps
Fire up a MySQL CLI connected to Vitess, and run the following:
CREATETABLEcustomer (
id INT UNSIGNED NOT NULL AUTO_INCREMENT PRIMARY KEY,
name VARCHAR(255),
description VARCHAR(255)
);
INSERT INTO customer () VALUES ();
Binary version
Version: f315cb35e (Git branch 'master') built on Fri Aug 28 13:21:19 UTC 2020
Yeah, the CREATE TABLE with NOT NULL was just to highlight a totally separate problem (which is obviously not a Vitess bug at all) that I had ruled out :)
Overview of the Issue
MySQL allows you to specify an
INSERT
with emptyVALUES
as long as all columns have a valid default. For example, the following is valid:But the following is not:
Connected to Vitess, we get a syntax error with the same
INSERT
:Reproduction Steps
Fire up a MySQL CLI connected to Vitess, and run the following:
Binary version
Operating system and Environment details
In the vtgate container:
On the host, where I'm running the client:
Log Fragments
I get the following log messages each time I run an unpatched
sqlx migrate run
:The text was updated successfully, but these errors were encountered: