{"action":"created","issue":{"url":"https://api.github.com/repos/robconery/massive-js/issues/62","labels_url":"https://api.github.com/repos/robconery/massive-js/issues/62/labels{/name}","comments_url":"https://api.github.com/repos/robconery/massive-js/issues/62/comments","events_url":"https://api.github.com/repos/robconery/massive-js/issues/62/events","html_url":"https://github.com/robconery/massive-js/issues/62","id":74745788,"number":62,"title":"Overriding existing table methods","user":{"login":"mzedeler","id":214645,"avatar_url":"https://avatars.githubusercontent.com/u/214645?v=3","gravatar_id":"","url":"https://api.github.com/users/mzedeler","html_url":"https://github.com/mzedeler","followers_url":"https://api.github.com/users/mzedeler/followers","following_url":"https://api.github.com/users/mzedeler/following{/other_user}","gists_url":"https://api.github.com/users/mzedeler/gists{/gist_id}","starred_url":"https://api.github.com/users/mzedeler/starred{/owner}{/repo}","subscriptions_url":"https://api.github.com/users/mzedeler/subscriptions","organizations_url":"https://api.github.com/users/mzedeler/orgs","repos_url":"https://api.github.com/users/mzedeler/repos","events_url":"https://api.github.com/users/mzedeler/events{/privacy}","received_events_url":"https://api.github.com/users/mzedeler/received_events","type":"User","site_admin":false},"labels":[],"state":"open","locked":false,"assignee":null,"milestone":null,"comments":2,"created_at":"2015-05-09T19:49:16Z","updated_at":"2015-05-10T12:38:53Z","closed_at":null,"body":"I tried (by accident) to override `db.user.insert` and got the error `bind message supplies 1 parameters, but prepared statement requires 2`.\r\n\r\nThe library should either treat it as an error if a built in method is overridden or behave as expected.\r\n"},"comment":{"url":"https://api.github.com/repos/robconery/massive-js/issues/comments/100634658","html_url":"https://github.com/robconery/massive-js/issues/62#issuecomment-100634658","issue_url":"https://api.github.com/repos/robconery/massive-js/issues/62","id":100634658,"user":{"login":"xivSolutions","id":853147,"avatar_url":"https://avatars.githubusercontent.com/u/853147?v=3","gravatar_id":"","url":"https://api.github.com/users/xivSolutions","html_url":"https://github.com/xivSolutions","followers_url":"https://api.github.com/users/xivSolutions/followers","following_url":"https://api.github.com/users/xivSolutions/following{/other_user}","gists_url":"https://api.github.com/users/xivSolutions/gists{/gist_id}","starred_url":"https://api.github.com/users/xivSolutions/starred{/owner}{/repo}","subscriptions_url":"https://api.github.com/users/xivSolutions/subscriptions","organizations_url":"https://api.github.com/users/xivSolutions/orgs","repos_url":"https://api.github.com/users/xivSolutions/repos","events_url":"https://api.github.com/users/xivSolutions/events{/privacy}","received_events_url":"https://api.github.com/users/xivSolutions/received_events","type":"User","site_admin":false},"created_at":"2015-05-10T12:38:53Z","updated_at":"2015-05-10T12:38:53Z","body":"@mzedeler  - It's hard to know exactly what's happening beyond the obvious here. The obvious is that your override of the generated `insert()` method attempts to perform an insert with a mismatch between expected parameter values, and actual parameter values. \r\n\r\nOne of the handy things about JavaScript is that is allows you to bolt on new methods/properties (\"overrides\") etc.. to your heart's content, and will try to do what you tell it to. \r\n\r\nOne of the challenges of Javascript is that it will allow you to bolt on new methods/properties (\"overrides\") etc. and will try to do what you tell it to *without complaining.*\r\n\r\nIn this case, it is doing almost exactly what you are asking - you added an override (intentionally or no) for an existing method which appears to build either a flawed SQL statement, or incorrectly matches parameter values to parameters specified. Massive attempts to execute, and Postgres itself complains to the PG library, which passes the error on up to Massive.\r\n\r\nIn any other language, (say, a strongly typed language such as C#) it is possible to create an override method which compiles, and executes without complaint from the compiler or runtime, and which still fails when it attempts to execute improperly constructed SQL against PG or any other database. \r\n\r\nIn other words, it doesn't matter if the method is an override or not, it still needs to pass to the backing store a SQL statement with a matching set of params and values. If the parameter values don't match the parameters specified, you will get a similar error. \r\n\r\nUnless I am missing something, the problem is not that Massive allowed an \"override\" but that there is a bug in the code in the \"override\" method itself? There is no way Massive, or any other library, can protect you from attempting to execute SQL with a mis-match between parameter placeholders and parameter values beyond doing precisely what happened here. \r\n\r\nIn other words, are you asking massive to warn you if a method in your own code attempts to override an existing method? Or are you asking massive to check what your override method does to make sure it is going to work correctly? The former is probably doable (though not practical, nor really necessary), the latter is not. If you choose to override a method, you do then need to make the code work properly.\r\n\r\nHave we missed something?"}}