Skip to main content
Question

Decimal Second precision on timestamp to PostGIS

  • July 17, 2013
  • 4 replies
  • 43 views

Forum|alt.badge.img
I have a table in PostGIS with a timestamp(4) (with time zone)  data type.    I am trying to insert a value of:

 

 

2013-07-06 14:24:50.200

 

 

What i get is the following:

 

 

2013-07-06 14:24:50+04

 

 

The +04 is obviously the timezone, which is fine, however i loose my precision on the seconds.   I have tried most everything and am stumped.

 

 

I am currently on still stuck in FME2011.

 

 

Thanks in advance for any insight!

 

 

 

This post is closed to further activity.
It may be an old question, an answered question, an implemented idea, or a notification-only post.
Please check post dates before relying on any information in a question or answer.
For follow-up or related questions, please post a new question or idea.
If there is a genuine update to be made, please contact us and request that the post is reopened.

4 replies

takashi
Celebrity
  • July 18, 2013
Hi,

 

 

According to the Postgresql documentation, the fractional part of Date/Time value does not seem to be output by default (ISO). To make sure whether correct value was inserted, you can use to_char function in a select statement.

 

 

Takashi

david_r
Celebrity
  • July 18, 2013
Hi,

 

 

Takashi is right, this is an issue related to the differences in storage vs. representation of timestamps in the database.

 

 

Here is a sample SELECT statement to output a timestamp in the desired format:

 

 

select to_char(my_timestamp, 'YYYY-MM-DD HH24:MI:SS.US') as my_timestamp_str

 

from my_table

 

 

David

Forum|alt.badge.img
  • Author
  • July 18, 2013

Thank guys for the response.    I have checked and i still seem to be loosing my decimals during the writing/bulk insert part.   I have tried to trick FME by setting different data types in write (char, etc) with no luck.

 

 

Any other suggestions?  


takashi
Celebrity
  • July 19, 2013
Hi,

 

 

I tested in FME 2013 SP2 and PostgresSQL 9.2, and missing of the fractional part was reproduced when writing a timestamp using the PostgreSQL writer. It could be an FME limitation but I cannot say any more things. To clarify this issue, I recommend you to ask the question to the Safe.   In addition, when I inserted a timestamp using an SQLCreator with the following SQL statement, the data was inserted correctly. SQL statements (parameter of SQLCreator): FME_SQL_DELIMITER ; -create table timestamp_test ( my_timestamp timestamp(4) with time zone ); insert into timestamp_test (my_timestamp) values ('2013-07-19 11:26:15.55');   Result shown on the Query Tool of pdAdmin III: 2013-07-19 11:26:15.55+09

 

 

Takashi