{"action":"created","issue":{"url":"https://api.github.com/repos/sequelize/sequelize/issues/6765","repository_url":"https://api.github.com/repos/sequelize/sequelize","labels_url":"https://api.github.com/repos/sequelize/sequelize/issues/6765/labels{/name}","comments_url":"https://api.github.com/repos/sequelize/sequelize/issues/6765/comments","events_url":"https://api.github.com/repos/sequelize/sequelize/issues/6765/events","html_url":"https://github.com/sequelize/sequelize/issues/6765","id":185686756,"number":6765,"title":"Unable to set boolean primitive value in JSONB column to false","user":{"login":"ktsashes","id":205630,"avatar_url":"https://avatars2.githubusercontent.com/u/205630?v=4","gravatar_id":"","url":"https://api.github.com/users/ktsashes","html_url":"https://github.com/ktsashes","followers_url":"https://api.github.com/users/ktsashes/followers","following_url":"https://api.github.com/users/ktsashes/following{/other_user}","gists_url":"https://api.github.com/users/ktsashes/gists{/gist_id}","starred_url":"https://api.github.com/users/ktsashes/starred{/owner}{/repo}","subscriptions_url":"https://api.github.com/users/ktsashes/subscriptions","organizations_url":"https://api.github.com/users/ktsashes/orgs","repos_url":"https://api.github.com/users/ktsashes/repos","events_url":"https://api.github.com/users/ktsashes/events{/privacy}","received_events_url":"https://api.github.com/users/ktsashes/received_events","type":"User","site_admin":false},"labels":[{"id":636646701,"url":"https://api.github.com/repos/sequelize/sequelize/labels/stale","name":"stale","color":"aaaaaa","default":false}],"state":"closed","locked":false,"assignee":null,"assignees":[],"milestone":null,"comments":0,"created_at":"2016-10-27T14:35:49Z","updated_at":"2018-05-16T15:18:26Z","closed_at":"2017-07-07T01:26:37Z","author_association":"NONE","body":"## What you are doing?\n\nTrying to set a primitive boolean value in a JSONB field to false fails.\n\n``` js\nvar model = sequelize.define('myModel', {\n  data: datatypes.JSONB,\n});\n\n// This insert query works, and properly escapes the true value to be 'true'\nmodel.insert({\n  data: true,\n});\n\n// This insert query does not work and does not properly escape a 'false' value\nmodel.insert({\n  data: false,\n});\n```\n## What do you expect to happen?\n\nData value set to false by escaping it to `'false'` in the query\n## What is actually happening?\n\nData value is not escaped and pg throws an error about a boolean value\n\nGenerated Code\n\n``` sql\nINSERT INTO \"myModel\" (\"id\",\"data\",\"updatedAt\",\"createdAt\") VALUES (DEFAULT,false,'2016-10-27 14:49:13.679 +00:00','2016-10-27 14:49:13.679 +00:00') RETURNING *;\n```\n\nWhich throws\n\n```\nSequelizeDatabaseError: column \"data\" is of type jsonb but expression is of type boolean\n```\n\n**Dialect:** postgres\n**Database version:** Postgres 9.4\n**Sequelize version:** 3.17.3\n"},"comment":{"url":"https://api.github.com/repos/sequelize/sequelize/issues/comments/389557532","html_url":"https://github.com/sequelize/sequelize/issues/6765#issuecomment-389557532","issue_url":"https://api.github.com/repos/sequelize/sequelize/issues/6765","id":389557532,"user":{"login":"nw0428","id":4731981,"avatar_url":"https://avatars1.githubusercontent.com/u/4731981?v=4","gravatar_id":"","url":"https://api.github.com/users/nw0428","html_url":"https://github.com/nw0428","followers_url":"https://api.github.com/users/nw0428/followers","following_url":"https://api.github.com/users/nw0428/following{/other_user}","gists_url":"https://api.github.com/users/nw0428/gists{/gist_id}","starred_url":"https://api.github.com/users/nw0428/starred{/owner}{/repo}","subscriptions_url":"https://api.github.com/users/nw0428/subscriptions","organizations_url":"https://api.github.com/users/nw0428/orgs","repos_url":"https://api.github.com/users/nw0428/repos","events_url":"https://api.github.com/users/nw0428/events{/privacy}","received_events_url":"https://api.github.com/users/nw0428/received_events","type":"User","site_admin":false},"created_at":"2018-05-16T15:18:26Z","updated_at":"2018-05-16T15:18:26Z","author_association":"NONE","body":"Is there any fix for this?\r\n"}}
{"actor":{"display_login":"nw0428"}}