{"action":"created","issue":{"url":"https://api.github.com/repos/terrajobst/nquery/issues/32","repository_url":"https://api.github.com/repos/terrajobst/nquery","labels_url":"https://api.github.com/repos/terrajobst/nquery/issues/32/labels{/name}","comments_url":"https://api.github.com/repos/terrajobst/nquery/issues/32/comments","events_url":"https://api.github.com/repos/terrajobst/nquery/issues/32/events","html_url":"https://github.com/terrajobst/nquery/issues/32","id":135498243,"number":32,"title":"Query generates incorrect result when using constants, works fine with parameters","user":{"login":"dallmair","id":9481495,"avatar_url":"https://avatars.githubusercontent.com/u/9481495?v=3","gravatar_id":"","url":"https://api.github.com/users/dallmair","html_url":"https://github.com/dallmair","followers_url":"https://api.github.com/users/dallmair/followers","following_url":"https://api.github.com/users/dallmair/following{/other_user}","gists_url":"https://api.github.com/users/dallmair/gists{/gist_id}","starred_url":"https://api.github.com/users/dallmair/starred{/owner}{/repo}","subscriptions_url":"https://api.github.com/users/dallmair/subscriptions","organizations_url":"https://api.github.com/users/dallmair/orgs","repos_url":"https://api.github.com/users/dallmair/repos","events_url":"https://api.github.com/users/dallmair/events{/privacy}","received_events_url":"https://api.github.com/users/dallmair/received_events","type":"User","site_admin":false},"labels":[],"state":"closed","locked":false,"assignee":null,"milestone":null,"comments":2,"created_at":"2016-02-22T18:17:39Z","updated_at":"2016-02-29T01:10:07Z","closed_at":"2016-02-29T01:07:37Z","body":"Run the following query in NQuery:\r\n\r\n```SQL\r\nSELECT ROUND(TO_DECIMAL(1.23), 4) AS Col1, TO_DECIMAL(TO_STRING(1.23) + '00') AS Col2\r\n```\r\n\r\nActual result is a table with a single row and two columns, Col1 and Col2. Both have the value 1.23.\r\nExpected result is a table in the same format, but with values 1.23 and 1.2300, respectively.\r\n\r\nInteresting facts:\r\n1. Change the first 1.23 to 1.24 and NQuery generates the expected result 1.24, 1.2300.\r\n2. Provide the value 1.23 as parameter instead of coding it as constant. In this case NQuery also generates the expected result 1.23, 1.2300."},"comment":{"url":"https://api.github.com/repos/terrajobst/nquery/issues/comments/189986696","html_url":"https://github.com/terrajobst/nquery/issues/32#issuecomment-189986696","issue_url":"https://api.github.com/repos/terrajobst/nquery/issues/32","id":189986696,"user":{"login":"terrajobst","id":5169960,"avatar_url":"https://avatars.githubusercontent.com/u/5169960?v=3","gravatar_id":"","url":"https://api.github.com/users/terrajobst","html_url":"https://github.com/terrajobst","followers_url":"https://api.github.com/users/terrajobst/followers","following_url":"https://api.github.com/users/terrajobst/following{/other_user}","gists_url":"https://api.github.com/users/terrajobst/gists{/gist_id}","starred_url":"https://api.github.com/users/terrajobst/starred{/owner}{/repo}","subscriptions_url":"https://api.github.com/users/terrajobst/subscriptions","organizations_url":"https://api.github.com/users/terrajobst/orgs","repos_url":"https://api.github.com/users/terrajobst/repos","events_url":"https://api.github.com/users/terrajobst/events{/privacy}","received_events_url":"https://api.github.com/users/terrajobst/received_events","type":"User","site_admin":false},"created_at":"2016-02-29T01:10:07Z","updated_at":"2016-02-29T01:10:07Z","body":"By the way, I can't this behavior doesn't repro in [nquery-vnext](http://github.com/terrajobst/nquery-vnext) because it doesn't use constant folding. I'm wondering whether adding constant folding is actually a good idea. The value gain is low and it does complicate the design quite a bit. Right now I'm thinking that [nquery-vnext](http://github.com/terrajobst/nquery-vnext) will not perform constant folding."}}