Creating a column of type: TIMESTAMP WITHOUT TIME ZONE in Postgresql results in "WITHOUT TIME ZONE" getting stripped out Follow
Hi there,
I am trailing DataGrip and using a Postgresql database. I am creating a table with the following column:
created TIMESTAMP WITHOUT TIME ZONE DEFAULT timezone('utc' :: TEXT, now()),
When I save the table I get no error.
When I edit the table again using DataGrip Modify Table GUI editor, it does not show "WITHOUT TIME ZONE".
When I view the table in pgAdmin, it does show the "WITHOUT TIME ZONE", so it has been saved by DataGrip, but it does not show it in the Modify Table window, or when view the create table statement using the DataGrip SQL Scripts > Source Editor option from the context menu. I did a reload of that script using the Reload button but it only shows the following:
created TIMESTAMP DEFAULT timezone('utc' :: TEXT, now()),
How can I resolve this? It is not much good if the GUI and table scripting functions do not represent the actual schema.
I am using:
------------------------------------------------------------------------------------------------------------------
Window 10 Pro 64bit
DataGrip 2017.3.7
Build #DB-173.4674.7, built on February 28, 2018
Licensed to DataGrip Evaluator
Expiration date: April 23, 2018
JRE: 1.8.0_152-release-1024-b15 amd64
JVM: OpenJDK 64-Bit Server VM by JetBrains s.r.o
Windows 10 10.0
PostgreSQL 10.1 on x86_64-pc-linux-musl, compiled by gcc (Alpine 6.3.0) 6.3.0, 64-bit
------------------------------------------------------------------------------------------------------------------
Regards,
codeOwl
Please sign in to leave a comment.
Hi!
It happens because TIMESTAMP and TIMESTAMP WITHOUT TIME ZONE is the equal data types.
See documentation https://www.postgresql.org/docs/9.2/static/datatype-datetime.html (the first note)
@Dmitriy,
Thanks for the response. This makes sense.
Regards,
codeowl