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

GetSchemaTable returns partial garbage #354

Closed
vl8163264128 opened this issue Oct 10, 2017 · 5 comments
Closed

GetSchemaTable returns partial garbage #354

vl8163264128 opened this issue Oct 10, 2017 · 5 comments
Assignees
Labels

Comments

@vl8163264128
Copy link

I have 2 tables that have the same structure and content, but one table works fine and the other one returns partial garbage with I call GetSchemaTable on it.

CREATE TABLE mytable (
tinyint-type tinyint(4) NOT NULL,
smallint-type smallint(6) NOT NULL,
mediumint-type mediumint(9) NOT NULL,
int-type int(11) NOT NULL,
bigint-type bigint(20) NOT NULL,
decimal-type decimal(10,0) NOT NULL,
float-type float NOT NULL,
double-type double NOT NULL,
real-type double NOT NULL,
bit-type bit(1) NOT NULL,
boolean-type tinyint(1) NOT NULL,
serial-type bigint(20) unsigned NOT NULL AUTO_INCREMENT,
tinyint-min-type tinyint(1) NOT NULL,
tinyint-max-type tinyint(8) NOT NULL,
smallint-min-type smallint(1) NOT NULL,
smallint-max-type smallint(16) NOT NULL,
mediumint-min-type mediumint(1) NOT NULL,
mediumint-max-type mediumint(24) NOT NULL,
int-min-type int(1) NOT NULL,
int-max-type int(32) NOT NULL,
bigint-min-type bigint(1) NOT NULL,
bigint-max-type bigint(64) NOT NULL,
decimal-min-type decimal(1,0) NOT NULL,
decimal-max-type decimal(65,30) NOT NULL,
float-min1-type float NOT NULL,
float-max1-type double NOT NULL,
float-min2-type float(1,0) NOT NULL,
float-max2-type float(255,30) NOT NULL,
double-min2-type double(1,0) NOT NULL,
double-max2-type double(255,30) NOT NULL,
bit-min-type bit(1) NOT NULL,
bit-max-type bit(64) NOT NULL,
tinyint-unsigned-type tinyint(3) unsigned NOT NULL,
smallint-unsigned-type smallint(5) unsigned NOT NULL,
mediumint-unsigned-type mediumint(8) unsigned NOT NULL,
int-unsigned-type int(10) unsigned NOT NULL,
bigint-unsigned-type bigint(20) unsigned NOT NULL,
decimal-unsigned-type decimal(10,0) unsigned NOT NULL,
float-unsigned-type float unsigned NOT NULL,
double-unsigned-type double unsigned NOT NULL,
real-unsigned-type double unsigned NOT NULL,
UNIQUE KEY serial-type (serial-type)
) ENGINE=InnoDB AUTO_INCREMENT=23454 DEFAULT CHARSET=latin1

@bgrainger
Copy link
Member

What version of MySQL Server (or MariaDB, Aurora, etc.) are you using? What OS?

What is the query (being passed to ExecuteReader)?

What is the "partial garbage" that is being returned? What did you expect to see, and what did you get instead?

I used the table schema you provided above (thank you for that) with the following code and didn't notice anything obviously wrong:

using (var cmd = connection.CreateCommand())
{
	cmd.CommandText = "SELECT * FROM mytable;";
	using (var reader = cmd.ExecuteReader())
	{
		var schemaTable = reader.GetSchemaTable(); // seems ok

@elemount
Copy link
Contributor

Hi @bgrainger , I talked with @vl8163264128 , and using his server I got the garbage.
With debugging, I see that in line https://github.com/mysql-net/MySqlConnector/blob/master/src/MySqlConnector/MySqlClient/Results/ResultSet.cs#L92 , when the column=37, the ColumnDefinitionPayload[0].OriginalPayload.ArraySegment.Array changed. It seems that the payload changed by Session.ReceiveReplyAsync and directly affected the ColumnDefinitionPayload[0].OriginalPayload

And @vl8163264128 , can you email to @bgrainger bgrainger@gmail.com with the server name, user name, password and scenario details?

@bgrainger
Copy link
Member

Yes, that makes complete sense. (I even considered that it was potentially a problem when I wrote 76b0612 but didn't try sufficiently hard to establish that it wouldn't be a problem.)

The fix should be pretty straightforward, so I probably won't need authentication details to verify it myself.

bgrainger added a commit to bgrainger/MySqlConnector that referenced this issue Oct 11, 2017
@bgrainger bgrainger added the bug label Oct 11, 2017
@bgrainger bgrainger self-assigned this Oct 11, 2017
@bgrainger
Copy link
Member

Fixed in 0.28.2.

@elemount
Copy link
Contributor

Talked with @vl8163264128 , he verified that the garbage is fixed by newest version.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
Development

No branches or pull requests

3 participants