oceanbase / oceanbase/seekdb

Fix error 3140 'Invalid JSON text' when inserting MAP literal '{1:NULL}'

Open
#759 1 comment 0 reactions 0 assignees View on GitHub

Nobody has claimed this yet.

dima type: bug
Dominant language
C++
Stars
2.9k
Forks
342
Avg merge
2d 14h
Merged PRs (30d)
53

Description

Description

When inserting a MAP literal '{1:NULL}' (with NULL in uppercase), the operation fails with error 3140: "Invalid JSON text".

Actual Behavior:
The INSERT statement fails.

Expected Behavior:
The INSERT statement should succeed, similar to the lowercase null literal ('{1:null}') which works correctly.

Steps to Reproduce

  1. Access the machine.
  2. Navigate to the directory: /obdata/data/AndroidTest/ob_opensource_test/tools/deploy
  3. Set up the test environment and run the specific mysqltest case using the following commands:
export OCEANBASE_HOME=/obdata/data/AndroidTest/ob_opensource_test/
cd ${OCEANBASE_HOME}/tools/deploy
source activate_obd.sh
export OBD_SEEKDB_STATUS_FALLBACK_TCP=1

obd test mysqltest test_env --mysqltest-bin=${OCEANBASE_HOME}/deps/3rd/u01/obclient/bin/mysqltest --obclient-bin=${OCEANBASE_HOME}/deps/3rd/u01/obclient/bin/obclient --init-only --init-sql-dir=${OCEANBASE_HOME}/tools/deploy --init-sql-files='init.sql,init_user.sql|root@sys|test'
obd test mysqltest test_env --mysqltest-bin=${OCEANBASE_HOME}/deps/3rd/u01/obclient/bin/mysqltest --obclient-bin=${OCEANBASE_HOME}/deps/3rd/u01/obclient/bin/obclient --disable-reboot --test-set=map.map_keys_mysql
  1. The issue can be reproduced with the following SQL statements:
USE test;

DROP TABLE IF EXISTS t4;
CREATE TABLE t4 (
  id INT NOT NULL AUTO_INCREMENT,
  m MAP(INT, INT[])
);
INSERT INTO t4(m) VALUES ('{1:[1],2:[2],3:[3]}');
INSERT INTO t4(m) VALUES ('{1:NULL}'); -- This line fails with error 3140.
-- Lowercase 'null' works correctly.
INSERT INTO t4(m) VALUES ('{1:null}');

Contributor guide

Open the contributing guide

First steps

  1. Read the whole issue, then the project's contributing guide.
  2. Comment on the issue to say you are picking it up — it saves two people doing the same work.
  3. Fork the repository and make your change on a branch.
  4. Open a pull request that references the issue number.

Research direction

Start in /obdata/data/AndroidTest/ob_opensource_test/tools/deploy and run the mysqltest case map.map_keys_mysql with the provided setup commands. Compare the INSERT statements using uppercase NULL and lowercase null, then trace the MAP literal handling reached by that test. Done means '{1:NULL}' inserts successfully without error 3140 while the existing lowercase case continues to work.

Written by the indexing model from the issue text.

Assessment

Tech stack
cpp, sql
Domain
databases
Issue type
Bug
Difficulty
3/5
Estimated time
1-2 days
Activity status
Quiet
Clarity
Mostly clear
Newbie friendliness
52/100

Get new issues in your inbox

A short digest of beginner-friendly GitHub issues.