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

IMPORT INTO data type issue #60058

Open
kissmydb opened this issue Mar 13, 2025 · 0 comments
Open

IMPORT INTO data type issue #60058

kissmydb opened this issue Mar 13, 2025 · 0 comments
Labels
type/bug The issue is confirmed as a bug.

Comments

@kissmydb
Copy link

疑似 import into 的 bug,在处理 binary/varbinary 的时候,没有加 unhex 处理,lightning 是没问题的

表结构:

mysql> show create table btc_udm_v2_accounts\G
*************************** 1. row ***************************
       Table: btc_udm_v2_accounts
Create Table: CREATE TABLE `btc_udm_v2_accounts` (
  `account` varbinary(60000) NOT NULL,
  `account_type` enum('UTXO','VIRTUAL','ACCOUNT','ESCROW','PAYMENT_CHANNEL') NOT NULL,
  `creation_height` int NOT NULL,
  `creation_consensus_time` datetime(6) NOT NULL,
  `creation_chain_sequence_number` bigint NOT NULL,
  `creation_block_hash` binary(32) NOT NULL,
  PRIMARY KEY (`account`(1000)) /*T![clustered_index] CLUSTERED */,
  KEY `btc_udm_v2_accounts_creation_consensus_time_creation_seq_num_id` (`creation_consensus_time`,`creation_chain_sequence_number`),
  KEY `btc_udm_v2_accounts_creation_height_creation_seq_num_idx` (`creation_height`,`creation_chain_sequence_number`),
  KEY `btc_udm_v2_accounts_creation_seq_num_account_idx` (`creation_chain_sequence_number`,`account`(1000))
) ENGINE=InnoDB DEFAULT CHARSET=utf8mb4 COLLATE=utf8mb4_bin
1 row in set (0.00 sec)

我挑一行 lightning 没问题的 csv 数据:

[likun@tidb-server-2 tmp]$ cat db1.test.csv
\x3148594b4844726d68376e4d443367374378586462594e5959575568746d65315836,UTXO,539000,2018-08-29 05:03:49+00,2314987372545789,\x0000000000000000001dc97478b5d0ce20ef443f43398fe11091d2da08ad30aa

import into 报错:

[types:1406]Data Too Long, field len 64, data len 65

insert 是可以成功的

mysql> insert into btc_udm_v2_accounts values('\x3148594b4844726d68376e4d443367374378586462594e5959575568746d65315836','UTXO',539000,'2018-08-29 05:03:49+00',2314987372545789,UNHEX('0000000000000000001dc97478b5d0ce20ef443f43398fe11091d2da08ad30aa'));
Query OK, 1 row affected (0.01 sec)
@kissmydb kissmydb added the type/bug The issue is confirmed as a bug. label Mar 13, 2025
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
type/bug The issue is confirmed as a bug.
Projects
None yet
Development

No branches or pull requests

1 participant