Default custom format for specific columns?

Поиск
Список
Период
Сортировка
От Dave Caughey
Тема Default custom format for specific columns?
Дата
Msg-id CAAj2gHzNu7NXRUy+Jxx0_8zy+QA+mEw8pp5+E-jCkMGu4mqu2A@mail.gmail.com
обсуждение исходный текст
Ответы Re: Default custom format for specific columns?  (Aditya Toshniwal <aditya.toshniwal@enterprisedb.com>)
Список pgadmin-support
In my databases, timestamps are stored as longs (epoch millis).

Consequently, when I do a query or view table, I always end up with values like 1612106244000, rather than a more readable format of "2021-01-31 15:17:24".

Yes, I realize I can do "to_timestamp(cast(mytimestamp/1000 as bigint))::timestamp" in a SELECT to convert "mytimestamp" to a human-readable form, but it means I have to hand-compose all my queries rather than being able to use all the convenient "View/Edit Data..." functions.

I'm wondering if there is a way to assign a conversion/formatting function (like the above) to specific table columns, e.g., by expanding the table's columns and editing the properties, so that whenever you do a view/edit data, it actually implements a  "to_timestamp(cast(mytimestamp/1000 as bigint))::timestamp" for the "mytimestamp" column?

If not, I'm happy to create a RM enhancement request.

Cheers,
Dave

В списке pgadmin-support по дате отправления:

Предыдущее
От: Cadstructure Technology
Дата:
Сообщение: Unable to installed postgis extension using stack builder
Следующее
От: Aditya Toshniwal
Дата:
Сообщение: Re: Default custom format for specific columns?