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

UNKNOWN_CODE_PLEASE_REPORT: ERROR 3730 (HY000): drop table / foreign key constraint #2402

Open
jcward opened this issue Sep 5, 2020 · 1 comment · May be fixed by #2386
Open

UNKNOWN_CODE_PLEASE_REPORT: ERROR 3730 (HY000): drop table / foreign key constraint #2402

jcward opened this issue Sep 5, 2020 · 1 comment · May be fixed by #2386

Comments

@jcward
Copy link

jcward commented Sep 5, 2020

MySQL server version 8
mysqljs 2.18.1

CREATE TABLE IF NOT EXISTS users (
  id INTEGER NOT NULL AUTO_INCREMENT,
  PRIMARY KEY (id)
);

CREATE TABLE IF NOT EXISTS foo (
  user_id INTEGER NOT NULL,
  FOREIGN KEY (user_id) REFERENCES users(id) ON DELETE CASCADE
);

DROP TABLE users;

ERROR 3730 (HY000): Cannot drop table 'users' referenced by a foreign key constraint 'foo_ibfk_1' on table 'foo'.

Error: UNKNOWN_CODE_PLEASE_REPORT: Cannot drop table 'a' referenced by a foreign key constraint 'b_ibfk_1' on table 'b'.
      >     at Query.Sequence._packetToError (...node_modules/mysql/lib/protocol/sequences/Sequence.js:47:14)
      >     at Query.ErrorPacket (...node_modules/mysql/lib/protocol/sequences/Query.js:79:18)
      >     at Protocol._parsePacket (...node_modules/mysql/lib/protocol/Protocol.js:291:23)
      >     at Parser._parsePacket (...node_modules/mysql/lib/protocol/Parser.js:433:10)
      >     at Parser.write (...node_modules/mysql/lib/protocol/Parser.js:43:10)
      >     at Protocol.write (...node_modules/mysql/lib/protocol/Protocol.js:38:16)
      >     at Socket.<anonymous> (...node_modules/mysql/lib/Connection.js:88:28)
      >     at Socket.<anonymous> (...node_modules/mysql/lib/Connection.js:526:10)
      >     at Socket.emit (events.js:315:20)
      >     at addChunk (_stream_readable.js:295:12)
@ARitz-Cracker
Copy link

I've created a pr that deals with this, #2386. It works well, though we'll have to see if it'll ever be merged

@ARitz-Cracker ARitz-Cracker linked a pull request Oct 12, 2020 that will close this issue
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Development

Successfully merging a pull request may close this issue.

2 participants