-
Notifications
You must be signed in to change notification settings - Fork 17.9k
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
database/sql: Support for time.Duration #4954
Labels
Milestone
Comments
Comment 2 by raul.san@sent.com: + Oracle implements SQL92's INTERVAL DAY TO SECOND + Mysql has TIME + PostreSQL has the INTERVAL + SQLite3 doesn't support any kind of time fields (datetime, time, interval), but accepts all as legal types so could be used INTEGER. |
Comment 3 by raul.san@sent.com: SQLite3 in SQLAlchemy was implemented using a string with SQL datatype "TEXT": https://bitbucket.org/sqlalchemy/sqlalchemy/src/02615a0fde68f339969c806460462ca1fd5a98f2/lib/sqlalchemy/dialects/sqlite/base.py?at=default#cl-309 There was a discussion in Django forums about its implementation in Django's ORM: https://groups.google.com/forum/?hl=en&fromgroups=#!topic/django-developers/0yMWznlk268 |
As I mentioned in a github issue (https://github.com/bmizerany/pq/issues/78) for the pq driver I don't think this is possible for Postgres. The interval datatype is a 12-byte value with a much larger range than time.Duration: http://www.postgresql.org/docs/9.2/static/datatype-datetime.html It seems Oracle's interval type supports up to 9 digits in the days field, which is also larger than time.Duration (290 years is ~105920 days) MySQL is more limited, the range is +/- 839 hours. |
Comment 5 by raul.san@sent.com: Then, since time.Duration is an int64 (http://golang.org/src/pkg/time/time.go?s=12544:12563#L374), could be used a SQL datatype to store an int64: + BIGINT in MySQL + bigint in PostgreSQL + INTEGER in SQLite3 |
This issue was closed.
Sign up for free
to subscribe to this conversation on GitHub.
Already have an account?
Sign in.
by raul.san@sent.com:
The text was updated successfully, but these errors were encountered: