{"action":"closed","issue":{"url":"https://api.github.com/repos/typeorm/typeorm/issues/241","repository_url":"https://api.github.com/repos/typeorm/typeorm","labels_url":"https://api.github.com/repos/typeorm/typeorm/issues/241/labels{/name}","comments_url":"https://api.github.com/repos/typeorm/typeorm/issues/241/comments","events_url":"https://api.github.com/repos/typeorm/typeorm/issues/241/events","html_url":"https://github.com/typeorm/typeorm/issues/241","id":203396406,"number":241,"title":"Error with alias in QueryBuilder for SQLite","user":{"login":"otgerrogla","id":2356820,"avatar_url":"https://avatars2.githubusercontent.com/u/2356820?v=3","gravatar_id":"","url":"https://api.github.com/users/otgerrogla","html_url":"https://github.com/otgerrogla","followers_url":"https://api.github.com/users/otgerrogla/followers","following_url":"https://api.github.com/users/otgerrogla/following{/other_user}","gists_url":"https://api.github.com/users/otgerrogla/gists{/gist_id}","starred_url":"https://api.github.com/users/otgerrogla/starred{/owner}{/repo}","subscriptions_url":"https://api.github.com/users/otgerrogla/subscriptions","organizations_url":"https://api.github.com/users/otgerrogla/orgs","repos_url":"https://api.github.com/users/otgerrogla/repos","events_url":"https://api.github.com/users/otgerrogla/events{/privacy}","received_events_url":"https://api.github.com/users/otgerrogla/received_events","type":"User","site_admin":false},"labels":[{"id":333605711,"url":"https://api.github.com/repos/typeorm/typeorm/labels/bug","name":"bug","color":"fc2929","default":true},{"id":628504132,"url":"https://api.github.com/repos/typeorm/typeorm/labels/comp:%20query%20builder","name":"comp: query builder","color":"1d76db","default":false}],"state":"closed","locked":false,"assignee":{"login":"AlexMesser","id":17142628,"avatar_url":"https://avatars0.githubusercontent.com/u/17142628?v=3","gravatar_id":"","url":"https://api.github.com/users/AlexMesser","html_url":"https://github.com/AlexMesser","followers_url":"https://api.github.com/users/AlexMesser/followers","following_url":"https://api.github.com/users/AlexMesser/following{/other_user}","gists_url":"https://api.github.com/users/AlexMesser/gists{/gist_id}","starred_url":"https://api.github.com/users/AlexMesser/starred{/owner}{/repo}","subscriptions_url":"https://api.github.com/users/AlexMesser/subscriptions","organizations_url":"https://api.github.com/users/AlexMesser/orgs","repos_url":"https://api.github.com/users/AlexMesser/repos","events_url":"https://api.github.com/users/AlexMesser/events{/privacy}","received_events_url":"https://api.github.com/users/AlexMesser/received_events","type":"User","site_admin":false},"assignees":[{"login":"AlexMesser","id":17142628,"avatar_url":"https://avatars0.githubusercontent.com/u/17142628?v=3","gravatar_id":"","url":"https://api.github.com/users/AlexMesser","html_url":"https://github.com/AlexMesser","followers_url":"https://api.github.com/users/AlexMesser/followers","following_url":"https://api.github.com/users/AlexMesser/following{/other_user}","gists_url":"https://api.github.com/users/AlexMesser/gists{/gist_id}","starred_url":"https://api.github.com/users/AlexMesser/starred{/owner}{/repo}","subscriptions_url":"https://api.github.com/users/AlexMesser/subscriptions","organizations_url":"https://api.github.com/users/AlexMesser/orgs","repos_url":"https://api.github.com/users/AlexMesser/repos","events_url":"https://api.github.com/users/AlexMesser/events{/privacy}","received_events_url":"https://api.github.com/users/AlexMesser/received_events","type":"User","site_admin":false}],"milestone":null,"comments":5,"created_at":"2017-01-26T15:13:42Z","updated_at":"2017-06-30T13:22:14Z","closed_at":"2017-06-30T13:22:14Z","body":"SQLite doesn't seem to support aliases on queries such as DELETE or UPDATE, so code generated like\r\n` UPDATE \"table\" \"t\" SET \"t\".\"field\" = 1 ` fails with `SQLITE_ERROR: near \"\"t\"\": syntax error`. \r\n\r\nA workaround is to use an empty string in ``createQueryBuilder(\"\")``, which does not write the alias. However, fields are still rewritten as ` \"\".\"field\" ` which causes an error.\r\nAdding a check ``if (!alias.name) return;`` at ``QueryBuilder.replacePropertyNames`` ([QueryBuilder.ts:1500](https://github.com/typeorm/typeorm/blob/master/src/query-builder/QueryBuilder.ts#L1500)) fixes this last problem for me.\r\n\r\nBut it still seems a hack. Maybe the parameter in `createQueryBuilder()` should be made optional (even if it's just then internally filled in with an empty string), as in most DELETE/UPDATE queries there is not usually the need to use an alias anyway.\r\n"}}
{"actor":{"display_login":"pleerock"}}