{"action":"closed","issue":{"url":"https://api.github.com/repos/sequelize/sequelize/issues/4398","labels_url":"https://api.github.com/repos/sequelize/sequelize/issues/4398/labels{/name}","comments_url":"https://api.github.com/repos/sequelize/sequelize/issues/4398/comments","events_url":"https://api.github.com/repos/sequelize/sequelize/issues/4398/events","html_url":"https://github.com/sequelize/sequelize/issues/4398","id":103528176,"number":4398,"title":"Deleting instance using different column name and field name causes issue on Postgres","user":{"login":"mikealeonetti","id":11664582,"avatar_url":"https://avatars.githubusercontent.com/u/11664582?v=3","gravatar_id":"","url":"https://api.github.com/users/mikealeonetti","html_url":"https://github.com/mikealeonetti","followers_url":"https://api.github.com/users/mikealeonetti/followers","following_url":"https://api.github.com/users/mikealeonetti/following{/other_user}","gists_url":"https://api.github.com/users/mikealeonetti/gists{/gist_id}","starred_url":"https://api.github.com/users/mikealeonetti/starred{/owner}{/repo}","subscriptions_url":"https://api.github.com/users/mikealeonetti/subscriptions","organizations_url":"https://api.github.com/users/mikealeonetti/orgs","repos_url":"https://api.github.com/users/mikealeonetti/repos","events_url":"https://api.github.com/users/mikealeonetti/events{/privacy}","received_events_url":"https://api.github.com/users/mikealeonetti/received_events","type":"User","site_admin":false},"labels":[],"state":"closed","locked":false,"assignee":null,"milestone":null,"comments":2,"created_at":"2015-08-27T14:52:55Z","updated_at":"2015-10-01T20:23:16Z","closed_at":"2015-10-01T20:23:16Z","body":"My model:\r\n```javascript\r\nvar schedule = sequelize.define( 'schedule', {\r\n\t'id': {\r\n\t\ttype: Sequelize.BIGINT.UNSIGNED,\r\n\t\tfield: 'schedule_id',\r\n\t\tautoIncrement: true,\r\n\t\tprimaryKey: true\r\n\t},\r\n\t'receiverID': {\r\n\t\ttype: Sequelize.BIGINT.UNSIGNED,\r\n\t\tfield: 'receiver_id',\r\n\t\tallowNull: false\r\n\t},\r\n\t'recordingID': {\r\n\t\ttype: Sequelize.BIGINT.UNSIGNED,\r\n\t\tfield: 'recording_id',\r\n\t\tallowNull: false\r\n\t},\r\n\t'minute' : {\r\n\t\ttype:  Sequelize.STRING( 32 ),\r\n\t\tfield: 'minute',\r\n\t\tallowNull: true\r\n\t},\r\n\t'hour' : {\r\n\t\ttype:  Sequelize.STRING( 32 ),\r\n\t\tfield: 'hour',\r\n\t\tallowNull: true\r\n\t},\r\n\t'day' : {\r\n\t\ttype:  Sequelize.STRING( 32 ),\r\n\t\tfield: 'day',\r\n\t\tallowNull: true\r\n\t},\r\n\t'month' : {\r\n\t\ttype:  Sequelize.STRING( 32 ),\r\n\t\tfield: 'month',\r\n\t\tallowNull: true\r\n\t},\r\n\t'wday' : {\r\n\t\ttype:  Sequelize.STRING( 32 ),\r\n\t\tfield: 'wday',\r\n\t\tallowNull: true\r\n\t},\r\n\t'time' : {\r\n\t\ttype:  Sequelize.DATE,\r\n\t\tfield: 'time',\r\n\t\tallowNull: true\r\n\t},\r\n\t'deleteAfter' : {\r\n\t\ttype:  Sequelize.BOOLEAN,\r\n\t\tfield: 'delete_after',\r\n\t\tdefaultValue: true\r\n\t},\r\n\t'playCount' : {\r\n\t\ttype: Sequelize.BIGINT.UNSIGNED,\r\n\t\tfield: 'play_count',\r\n\t\tallowNull: false,\r\n\t\tdefaultValue: 0\r\n\t}\r\n}, {\r\n\t'createdAt' : 'created',\r\n\t'updatedAt' : 'modified',\r\n\t'tableName' : 'schedules',\r\n\t'underscored' : true\r\n} );\r\n```\r\nDeleting code:\r\n```javascript\r\n\tdb.schedule.find( {\r\n\t\t'where' : {\r\n\t\t\t'id' : params.scheduleID,\r\n\t\t\t'receiverID' : this.receiverID\r\n\t\t}\r\n\t} )\r\n\t.then( function( schedule ) {\r\n\t\t\tschedule.destroy()\r\n\t\t\t.error( function( error ) {\r\n\t\t\t\tlog.client.error( \"[%s] Speak error deleting finished schedule.\",\r\n\t\t\t\t\tthat.remoteAddress,\r\n\t\t\t\t\tparams,\r\n\t\t\t\t\terror\r\n\t\t\t\t);\r\n\t\t\t} );\r\n\t} )\r\n\t.error( function( error ) {\r\n\t\tlog.client.error( \"[%s] Speak error finding schedule to increment.\",\r\n\t\t\tthat.remoteAddress,\r\n\t\t\tparams,\r\n\t\t\terror\r\n\t\t);\r\n\t} );\r\n```\r\nThe error:\r\n```\r\ninfo: Executing (default): DELETE FROM \"schedules\" WHERE \"id\" IN (SELECT \"id\" FROM \"schedules\" WHERE \"schedule_id\" = '1' LIMIT 1)\r\nerror: [127.0.0.1] Speak error deleting finished schedule. { action: 'runTask',\r\n  scheduleID: 1,\r\n  command: 'report',\r\n  seq: 3,\r\n  _sendMessage: [Function],\r\n  _sendData: [Function] } SequelizeDatabaseError: column \"id\" does not exist\r\n    at module.exports.Query.formatError (/home/mike/dev/node/soundwave/node_modules/sequelize/lib/dialects/postgres/query.js:421:16)\r\n    at null.<anonymous> (/home/mike/dev/node/soundwave/node_modules/sequelize/lib/dialects/postgres/query.js:105:21)\r\n    at emit (events.js:95:17)\r\n    at Query.handleError (/home/mike/dev/node/soundwave/node_modules/pg/lib/query.js:99:8)\r\n    at null.<anonymous> (/home/mike/dev/node/soundwave/node_modules/pg/lib/client.js:166:26)\r\n    at emit (events.js:95:17)\r\n    at Socket.<anonymous> (/home/mike/dev/node/soundwave/node_modules/pg/lib/connection.js:109:12)\r\n    at Socket.emit (events.js:95:17)\r\n    at Socket.<anonymous> (_stream_readable.js:764:14)\r\n    at Socket.emit (events.js:92:17)\r\n    at emitReadable_ (_stream_readable.js:426:10)\r\n    at emitReadable (_stream_readable.js:422:5)\r\n    at readableAddChunk (_stream_readable.js:165:9)\r\n    at Socket.Readable.push (_stream_readable.js:127:10)\r\n    at TCP.onread (net.js:528:21)\r\n```\r\n\r\nLooks like it doesn't like that I am using \"id\" but the column is actually \"schedule_id\"."}}