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

error "There is no primary key here. Update will only use exact matching of the old values of the columns here. Thus, it may update more than one record." #3005

Closed
Myshiner opened this issue Sep 9, 2019 · 4 comments · Fixed by #3379

Comments

@Myshiner
Copy link

Myshiner commented Sep 9, 2019

project: sharding-proxy
version: v3.1.0 & v4.0.0-RC2

question:
when i use navicate to connect sharding-proxy, and do double-click the table(any table), it can load all the datas but just threw the errors like "There is no primary key here. Update will only use exact matching of the old values of the columns here. Thus, it may update more than one record."

@Myshiner
Copy link
Author

Myshiner commented Sep 9, 2019

All the tables do have primary key.

@dongzl
Copy link
Contributor

dongzl commented Oct 22, 2019

I am glad to finish it.

@dongzl
Copy link
Contributor

dongzl commented Oct 23, 2019

I get the network packet through Wireshark software, and find some problem.

When MySQL transfer data to Sharding-Proxy:

MySQL实际抓包

When Sharding-Proxy transfer data to Navicat:

Sharding-Proxy_to_Navicat

the two byte data 03 50 is missing, it is the table Primary Key flag.

I think this make the mistake.

@dongzl
Copy link
Contributor

dongzl commented Oct 24, 2019

I debug Sharding-Proxy source code, when execute a query SQL, it should return column metadata.
But in MySQLColumnDefinition41Packet class, the this.flags = 0 :

image

this is the table column primary key flag, so the Navicat prompt a error message.

the MySQLColumnDefinition41Packet build by ResultSetMetadata, but ResultSetMetadata don't have primary key info, we can find primary key info in DatabaseMetadata, but it will be a huge change.

Is this a good way?

terrymanu pushed a commit that referenced this issue Oct 29, 2019
* fixes #3005, QueryHeader add primaryKey, nullable, autoIncrement, signed field.

* add apache license (#3005)

* fixes code review.(#3005)

* fixes column name.(#3005)

* add test case.(#3005)

* add QueryHeader test case.(#3005)

* fixes checkstyle.(#3005)

* fixes param name, nullable -> notNull.(#3005)
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Projects
None yet
Development

Successfully merging a pull request may close this issue.

3 participants