{"action":"created","issue":{"url":"https://api.github.com/repos/h2database/h2database/issues/1372","repository_url":"https://api.github.com/repos/h2database/h2database","labels_url":"https://api.github.com/repos/h2database/h2database/issues/1372/labels{/name}","comments_url":"https://api.github.com/repos/h2database/h2database/issues/1372/comments","events_url":"https://api.github.com/repos/h2database/h2database/issues/1372/events","html_url":"https://github.com/h2database/h2database/issues/1372","id":349813061,"node_id":"MDU6SXNzdWUzNDk4MTMwNjE=","number":1372,"title":"INTERVAL data type","user":{"login":"katzyn","id":23182944,"node_id":"MDQ6VXNlcjIzMTgyOTQ0","avatar_url":"https://avatars0.githubusercontent.com/u/23182944?v=4","gravatar_id":"","url":"https://api.github.com/users/katzyn","html_url":"https://github.com/katzyn","followers_url":"https://api.github.com/users/katzyn/followers","following_url":"https://api.github.com/users/katzyn/following{/other_user}","gists_url":"https://api.github.com/users/katzyn/gists{/gist_id}","starred_url":"https://api.github.com/users/katzyn/starred{/owner}{/repo}","subscriptions_url":"https://api.github.com/users/katzyn/subscriptions","organizations_url":"https://api.github.com/users/katzyn/orgs","repos_url":"https://api.github.com/users/katzyn/repos","events_url":"https://api.github.com/users/katzyn/events{/privacy}","received_events_url":"https://api.github.com/users/katzyn/received_events","type":"User","site_admin":false},"labels":[],"state":"open","locked":false,"assignee":null,"assignees":[],"milestone":null,"comments":1,"created_at":"2018-08-12T13:33:18Z","updated_at":"2018-08-12T14:01:37Z","closed_at":null,"author_association":"CONTRIBUTOR","body":"There are 13 types of intervals in the SQL standard. `YEAR`, `MONTH`, `DAY`, `HOUR`, `MINUTE`, `SECOND`, `YEAR TO MONTH`, `DAY TO HOUR`, `DAY TO MINUTE`, `DAY TO SECOND`, `HOUR TO MINUTE`, `HOUR TO SECOND`, and `MINUTE TO SECOND`. They also can have leading field precision and fractional seconds precision that can be stored as precision and scale, but precision may be less than scale for this data type because they are not related to each other.\r\n\r\nHow to represent type of value with all these subtypes? We need to know the subtype in conversion operations and may be in other places. I have only two ideas:\r\n1. Use a separate value type for each subtype (`Value.INTERVAL_YEAR` and so on).\r\n2. Add a new parameter and use it everywhere (add a method to all expressions, pass it to `Value.convertTo()`).\r\n\r\nBoth ideas don't look nice."},"comment":{"url":"https://api.github.com/repos/h2database/h2database/issues/comments/412344953","html_url":"https://github.com/h2database/h2database/issues/1372#issuecomment-412344953","issue_url":"https://api.github.com/repos/h2database/h2database/issues/1372","id":412344953,"node_id":"MDEyOklzc3VlQ29tbWVudDQxMjM0NDk1Mw==","user":{"login":"grandinj","id":796121,"node_id":"MDQ6VXNlcjc5NjEyMQ==","avatar_url":"https://avatars1.githubusercontent.com/u/796121?v=4","gravatar_id":"","url":"https://api.github.com/users/grandinj","html_url":"https://github.com/grandinj","followers_url":"https://api.github.com/users/grandinj/followers","following_url":"https://api.github.com/users/grandinj/following{/other_user}","gists_url":"https://api.github.com/users/grandinj/gists{/gist_id}","starred_url":"https://api.github.com/users/grandinj/starred{/owner}{/repo}","subscriptions_url":"https://api.github.com/users/grandinj/subscriptions","organizations_url":"https://api.github.com/users/grandinj/orgs","repos_url":"https://api.github.com/users/grandinj/repos","events_url":"https://api.github.com/users/grandinj/events{/privacy}","received_events_url":"https://api.github.com/users/grandinj/received_events","type":"User","site_admin":false},"created_at":"2018-08-12T14:01:37Z","updated_at":"2018-08-12T14:01:37Z","author_association":"CONTRIBUTOR","body":"For ENUM it might be worth just fetching the enumerators and storing it in the ValueEnum object always, so that it's easier to get to from the code and to validate. If I'd known how much pain ENUM would be, I would not have implemented it, it's a horrible datatype.\r\n\r\nFor INTERVAL, I suggest we use a separate Value.INTERVAL_XXX constant for each one, just make the range of constants continuous, so it's easy to write a utility method in Value like\r\n\r\n    boolean isIntervalType(int x)\r\n\r\nI'd rather make the INTERVAL code a little more verbose, rather than making everything else pay the price for it.\r\n"}}
{"actor":{"display_login":"grandinj"}}