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

panic at decoding row #64

Closed
broomstar opened this issue Jan 16, 2020 · 1 comment
Closed

panic at decoding row #64

broomstar opened this issue Jan 16, 2020 · 1 comment
Labels
bug db:mysql Related to MySQL

Comments

@broomstar
Copy link

broomstar commented Jan 16, 2020

Simply reproducing the case with table:

CREATE TABLE `accounts` (
  `id` int(11) NOT NULL AUTO_INCREMENT,
  `field2` varchar(30) NOT NULL DEFAULT '',
  `field3` varchar(255) NOT NULL DEFAULT '',
  `field4` tinyint(4) NOT NULL DEFAULT '0',
  `field5` timestamp NULL DEFAULT NULL,
  `field6` timestamp NULL DEFAULT CURRENT_TIMESTAMP,
  `field7` tinyint(4) NOT NULL DEFAULT '0',
  `field8` text,
  `field9` tinyint(4) NOT NULL DEFAULT '0',
  `field10` tinytext,
  `field11` tinytext,
  `field12` timestamp NOT NULL DEFAULT '2000-01-01 00:00:00',
  `field13` tinyint(4) DEFAULT NULL,
  `field14` int(11) DEFAULT '0',
  `field15` int(11) DEFAULT NULL,
  `field16` tinyint(4) NOT NULL DEFAULT '10',
  `field17` varchar(64) DEFAULT NULL,
  `field18` int(11) NOT NULL DEFAULT '0',
  `field19` int(11) NOT NULL DEFAULT '0',
  `field20` timestamp NULL DEFAULT NULL,
  `field21` timestamp NULL DEFAULT NULL,
  `field22` int(3) DEFAULT NULL,
  `field23` int(6) NOT NULL DEFAULT '0',
  `field24` int(6) NOT NULL DEFAULT '0',
  `field25` bigint(20) NOT NULL DEFAULT '0',
  `field26` int(11) DEFAULT '0',
  PRIMARY KEY (`id`),
  UNIQUE KEY `field2` (`field2`),
  KEY `ranking1` (`id`,`field7`,`field13`)
) ENGINE=InnoDB AUTO_INCREMENT=4 DEFAULT CHARSET=utf8 ROW_FORMAT=DYNAMIC

insert into accounts (field2) values ('rust');
let row = sqlx::query("SELECT * FROM accounts")
        .fetch_one(&mut conn)
        .await?;

problem: thread 'main' panicked at 'index out of bounds: the len is 58 but the index is 235', cargo/registry/src/git.luolix.top-1ecc6299db9ec823/sqlx-core-0.2.0/src/mysql/protocol/row.rs:107:65

@mehcode
Copy link
Member

mehcode commented Jan 16, 2020

Thanks for the issue report. We talked on Discord but to recap, this was an issue of how we were interpreting null values when decoding the row from MySQL.

This was fixed in #65 and is out as v0.2.1

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
bug db:mysql Related to MySQL
Projects
None yet
Development

No branches or pull requests

2 participants