Skip to content

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

Open
@jcward

Description

@jcward

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)

Metadata

Metadata

Assignees

No one assigned

    Labels

    No labels
    No labels

    Type

    No type

    Projects

    No projects

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions