[MDEV-12093] Column type for unix_timestamp Created: 2017-02-20  Updated: 2017-10-12

Status: Open
Project: MariaDB Server
Component/s: Data Definition - Alter Table
Fix Version/s: None

Type: Task Priority: Minor
Reporter: Olaf van der Spek Assignee: Unassigned
Resolution: Unresolved Votes: 0
Labels: None


 Description   

I'd like to have a proper type for unix_timestamp columns. Currently I'm (ab)using int.
One problem is that GUI tools don't know it's a unix_timestamp and will display it as a regular int, which isn't very helpful.



 Comments   
Comment by Sergei Golubchik [ 2017-05-25 ]

What do you mean by that? How should it differ from TIMESTAMP column?

Comment by Olaf van der Spek [ 2017-05-26 ]

It should behave like an int column, but the type would allow GUI tools to format the timestamp for humans.

The problem with timestamp is the formatting/parsing on every query and perhaps timezone issues.
A client flag to have timestamp values formatted as ints might be another option to avoid this problem.

Yet another option would be to allow meta-data to be stored for fields (and tables / databases) such that tools can attach their meta-data to it

Comment by Sergei Golubchik [ 2017-05-26 ]

By "behave like an int column, but allow GUI to format for humans", you mean something like

SELECT timestamp_column, timestamp_column + 10 FROM t1
+---------------------+---------------------+
| 2010-12-31 23:59:55 | 2011-01-01 00:00:05 |
+---------------------+---------------------+

right? That is, arithmetical operations work on integers, but the client shows as a datetime value?

Comment by Olaf van der Spek [ 2017-05-26 ]

Yep

Comment by Olaf van der Spek [ 2017-10-12 ]

To clarify, the formatting should be done by the client, not by the server. In C and PHP clients, I still want to traffic in ints..

Generated at Thu Feb 08 07:55:03 UTC 2024 using Jira 8.20.16#820016-sha1:9d11dbea5f4be3d4cc21f03a88dd11d8c8687422.