{"action":"created","issue":{"url":"https://api.github.com/repos/jinzhu/gorm/issues/1932","repository_url":"https://api.github.com/repos/jinzhu/gorm","labels_url":"https://api.github.com/repos/jinzhu/gorm/issues/1932/labels{/name}","comments_url":"https://api.github.com/repos/jinzhu/gorm/issues/1932/comments","events_url":"https://api.github.com/repos/jinzhu/gorm/issues/1932/events","html_url":"https://github.com/jinzhu/gorm/issues/1932","id":329711998,"node_id":"MDU6SXNzdWUzMjk3MTE5OTg=","number":1932,"title":"The precondition to perform the delete is invalid?","user":{"login":"TaoSunkist","id":17812144,"node_id":"MDQ6VXNlcjE3ODEyMTQ0","avatar_url":"https://avatars0.githubusercontent.com/u/17812144?v=4","gravatar_id":"","url":"https://api.github.com/users/TaoSunkist","html_url":"https://github.com/TaoSunkist","followers_url":"https://api.github.com/users/TaoSunkist/followers","following_url":"https://api.github.com/users/TaoSunkist/following{/other_user}","gists_url":"https://api.github.com/users/TaoSunkist/gists{/gist_id}","starred_url":"https://api.github.com/users/TaoSunkist/starred{/owner}{/repo}","subscriptions_url":"https://api.github.com/users/TaoSunkist/subscriptions","organizations_url":"https://api.github.com/users/TaoSunkist/orgs","repos_url":"https://api.github.com/users/TaoSunkist/repos","events_url":"https://api.github.com/users/TaoSunkist/events{/privacy}","received_events_url":"https://api.github.com/users/TaoSunkist/received_events","type":"User","site_admin":false},"labels":[],"state":"open","locked":false,"assignee":null,"assignees":[],"milestone":null,"comments":0,"created_at":"2018-06-06T05:06:30Z","updated_at":"2018-06-14T03:17:02Z","closed_at":null,"author_association":"NONE","body":"Your issue may already be reported! Please search on the [issue track](https://github.com/jinzhu/gorm/issues) before creating one.\r\n\r\n### What version of Go are you using (`go version`)?\r\n#### go version go1.10.1 linux/amd64\r\n\r\n### Which database and its version are you using?\r\n#### postgres\r\n```\r\neg1:\r\ntx.Debug().Where(\"coin_id = ?\", symbol.Name).Delete(&blockcc.Ticker{})\r\nOutput: DELETE FROM \"temp_tickers\"  WHERE (coin_id = 'okb')\r\n\r\neg:2\r\ntx.Debug().Delete(&blockcc.Ticker{CoinID: symbol.Name})\r\nOutput: DELETE FROM \"temp_tickers\"  \r\n```\r\nWhy the condition specified in eg2 is invalid?\r\n\r\n"},"comment":{"url":"https://api.github.com/repos/jinzhu/gorm/issues/comments/397157330","html_url":"https://github.com/jinzhu/gorm/issues/1932#issuecomment-397157330","issue_url":"https://api.github.com/repos/jinzhu/gorm/issues/1932","id":397157330,"node_id":"MDEyOklzc3VlQ29tbWVudDM5NzE1NzMzMA==","user":{"login":"gstvg","id":28798827,"node_id":"MDQ6VXNlcjI4Nzk4ODI3","avatar_url":"https://avatars1.githubusercontent.com/u/28798827?v=4","gravatar_id":"","url":"https://api.github.com/users/gstvg","html_url":"https://github.com/gstvg","followers_url":"https://api.github.com/users/gstvg/followers","following_url":"https://api.github.com/users/gstvg/following{/other_user}","gists_url":"https://api.github.com/users/gstvg/gists{/gist_id}","starred_url":"https://api.github.com/users/gstvg/starred{/owner}{/repo}","subscriptions_url":"https://api.github.com/users/gstvg/subscriptions","organizations_url":"https://api.github.com/users/gstvg/orgs","repos_url":"https://api.github.com/users/gstvg/repos","events_url":"https://api.github.com/users/gstvg/events{/privacy}","received_events_url":"https://api.github.com/users/gstvg/received_events","type":"User","site_admin":false},"created_at":"2018-06-14T03:17:02Z","updated_at":"2018-06-14T03:17:02Z","author_association":"NONE","body":"Isnt invalid, gorm just wont use non-primary fields on Delete. \r\n\r\nhttp://doc.gorm.io/crud.html#delete  says:\r\n\r\n\"WARNING When delete a record, you need to ensure it's primary field has value, and GORM will use the primary key to delete the record, if primary field's blank, GORM will delete all records for the model\"\r\n\r\nIf you called BlockGlobalUpdate(true) then delete with no pk is a no-op.\r\nSimilar behavior of what you expected can be achieved with db.Where(&ticker).Delete(&ticker)\r\n"}}
{"actor":{"display_login":"gstvg"}}