Skip to content

mysql GEOMETRY bug #4953

@zhfish

Description

@zhfish

https://github.com/sequelize/sequelize/blob/master/lib/dialects/mysql/data-types.js#L64

value.buffer() maybe is null

node_modules/mysql/lib/protocol/Parser.js:82
        throw err;
        ^

TypeError: Cannot read property 'slice' of null
    at Object.GEOMETRY.parse.GEOMETRY.parse [as GEOMETRY] 
users:
    ID: {
      type: 'CHAR(36)',
      allowNull: false,
      defaultValue: '',
      primaryKey: true
    },
    groupID: {
      type: type: 'CHAR(36)',
      allowNull: false
    },

groups:
    ID: {
      type: 'CHAR(36)',
      allowNull: false,
      defaultValue: '',
      primaryKey: true
    },
    location: {
      type: DataTypes.GEOMETRY,
      allowNull: false
    }

db.users.belongsTo(db.groups,{foreignKey:'groupID',targetKey:'ID'});

query

 let userInfo = yield db.users.findAll({
    include: [db.groups]
  });

I temporarily fix it

    value = value.buffer();
    if (value == null) {
      return null;
    }

    value = value.slice(4);

Metadata

Metadata

Assignees

No one assigned

    Labels

    dialect: mysqlFor issues and PRs. Things that involve MySQL (and do not involve all dialects).good first issueFor issues. An issue that is a good choice for first-time contributors.type: bugDEPRECATED: replace with the "bug" issue type

    Type

    No type

    Projects

    No projects

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions