Skip to content

Whether executing SELECT with INET_ATON() after the INSERT results in inconsistent behaviors in transaction #64347

@sayJason

Description

@sayJason

Bug Report

Please answer these questions before submitting your issue. Thanks!

1. Minimal reproduce step (Required)

/* init */ DROP TABLE IF EXISTS t;
/* init */ CREATE TABLE t (c1 DOUBLE NOT NULL, c2 BIT);;
/* init */ INSERT INTO t(c1, c2) VALUES (5.02, b'0');

-- not in transaction
/* s */ INSERT INTO t(c1,c2) VALUES (-1.54,b'1');
/* s */ SELECT * FROM t WHERE (INET_ATON('test')) UNION SELECT c1, c2 FROM t; -- [1]

-- in transaction
/* t1 */ BEGIN;
/* t1 */ SELECT * FROM t WHERE (INET_ATON('test')) UNION SELECT c1, c2 FROM t; -- [2]

-- in transaction after an INSERT
/* t1 */ BEGIN;
/* t1 */ INSERT INTO t(c1,c2) VALUES (-1.54,b'1');
/* t1 */ SELECT * FROM t WHERE (INET_ATON('test')) UNION SELECT c1, c2 FROM t; -- [3]

2. What did you expect to see? (Required)

The results of the SELECT statements [1], [2] and [3] are the same.

3. What did you see instead (Required)

The SELECT statements [1], [2] have retrieved the results, while the SELECT statement [3] gets an error.

[1] SELECT not in a transaction:

mysql> INSERT INTO t(c1,c2) VALUES (-1.54,b'1');
Query OK, 1 row affected (0.01 sec)

mysql> SELECT * FROM t WHERE (INET_ATON('test')) UNION SELECT c1, c2 FROM t;
+-------+------------+
| c1    | c2         |
+-------+------------+
| -1.54 | 0x01       |
|  5.02 | 0x00       |
+-------+------------+
2 rows in set (0.00 sec)

[2] SELECT in a transaction:

mysql> BEGIN;
Query OK, 0 rows affected (0.00 sec)

mysql> SELECT * FROM t WHERE (INET_ATON('test')) UNION SELECT c1, c2 FROM t;
+------+------------+
| c1   | c2         |
+------+------------+
| 5.02 | 0x00       |
+------+------------+
1 row in set (0.01 sec)

[3] SELECT in a transaction after an INSERT

mysql> BEGIN;
Query OK, 0 rows affected (0.00 sec)

mysql> INSERT INTO t(c1,c2) VALUES (-1.54,b'1');
Query OK, 1 row affected (0.01 sec)

mysql> SELECT * FROM t WHERE (INET_ATON('test')) UNION SELECT c1, c2 FROM t;
ERROR 1411 (HY000): Incorrect string value: 'test' for function inet_aton

4. What is your TiDB version? (Required)

Release Version: v8.5.3
Edition: Community
Git Commit Hash: dc2548aac79a712265e831cff2a3a896bc0a5a38
Git Branch: HEAD
UTC Build Time: 2025-07-31 13:54:43
GoVersion: go1.23.8
Race Enabled: false
Check Table Before Drop: false
Store: tikv

Metadata

Metadata

Assignees

No one assigned

    Labels

    contributionThis PR is from a community contributor.first-time-contributorIndicates that the PR was contributed by an external member and is a first-time contributor.type/bugThe issue is confirmed as a bug.

    Type

    No type

    Projects

    No projects

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions