Обсуждение: Specified date type but created column is timestamp without time zone

Поиск
Список
Период
Сортировка

Specified date type but created column is timestamp without time zone

От
Mike Elston
Дата:
Hi

I created a table containing a column of type "date" but the describe command reports that the created column is "timestamp without time zone". Why isn't it simply "date"?

psql (EnterpriseDB) 13.4.8 

mifis=> create table test (test_date date);
CREATE TABLE
mifis=> describe test;
                           Table "public.test"
  Column   |            Type             | Collation | Nullable | Default
-----------+-----------------------------+-----------+----------+---------
 test_date | timestamp without time zone |           |          |


According to https://www.postgresql.org/docs/9.1/datatype-datetime.html date is a distinct type occupying four bytes whereas timestamp without time zone occupies 8 bytes.

Thanks

Mike

Re: Specified date type but created column is timestamp without time zone

От
Tom Lane
Дата:
Mike Elston <mike.elston@gmail.com> writes:
> I created a table containing a column of type "date" but the
> describe command reports that the created column is "timestamp without time
> zone". Why isn't it simply "date"?

> psql (EnterpriseDB) 13.4.8

If you're using EDB, their server is hacked in a lot of ways to act
more like Oracle, and I think this discrepancy is one of them.
Oracle's idea of "date" corresponds more or less to our "timestamp",
so they translate.

            regards, tom lane