Question

Value of attribute could not be converted to type 'timestamptz'.

  • 23 April 2024
  • 3 replies
  • 28 views

Badge +1

I am trying to upload ifc data through PostGIS Writer and while doing so, I want to generate and store the time of upload as well. However, it gives the following error: “Value of attribute 'begin_lifespan_version' could not be converted to type 'timestamptz'. Feature will be logged and skipped.” 

can someone help? I am a beginner in FME as well.

 


 


3 replies

Userlevel 2
Badge +10

Hi @kersy, what is the data type for your “begin_lifespan_version” column in PostGIS? Does this match the data type that is set on the PostGIS Writer in FME Workbench?

You can check this by double clicking on the PostGIS Writer and then going to the User Attributes tab. If you set the Attribute Definition to Manual you can change the data type to make sure it matches the database schema.

 

Additionally, would you be able to share an example of your data before and after the DateTimeConverter? I expect something is happening in these steps that causing the PostGIS Writer to refuse to write the datetime value to the “begin_lifespan_version” column.

 

Thanks,

Dan

Badge +1

Hi @kersy, what is the data type for your “begin_lifespan_version” column in PostGIS? Does this match the data type that is set on the PostGIS Writer in FME Workbench?

You can check this by double clicking on the PostGIS Writer and then going to the User Attributes tab. If you set the Attribute Definition to Manual you can change the data type to make sure it matches the database schema.

 

Additionally, would you be able to share an example of your data before and after the DateTimeConverter? I expect something is happening in these steps that causing the PostGIS Writer to refuse to write the datetime value to the “begin_lifespan_version” column.

 

Thanks,

Dan

Hi @damaiterus23,
I am using a “timestamp with zone” in the database (as you can see below):
 


Honestly, initially I had created a trigger in the database that allowed me to create and store a timestamp to my “begin_lifespan_version” which was working when data was imported manually through PostSQL. However, when used FME to import data, FME would automatically by default give this attribute a “null” value because I wasn’t giving/assigning a new value in my writer, which in the end would overwrite my trigger and stay null. Thus, I deleted the trigger from the database and tried assigning the “current time of uploading data” through FME. 

I have used timestamp, timestampz, text, numeric etc. for attribute type in the writer but nothing worked in the end. 
 


Also, for the before and after of using DateTimeConverter, you can see the images below. 

before:
 


after with parameters used:
 



 

Userlevel 2
Badge +10

@kersy I apologize for the late reply, I just had a chance to come back to your question and test out the setup on one of our PostGIS databases.

 

The database is refusing the insert the new features because the value for your begin_lifespan_version must contain a timestamp with a timezone.

Currently you’re passing through just a date (y-m-d). If you edit the DateTimeStamper to also include the timezone, then this will work correctly. You will also need to set the data type on the PostGIS writer to timestampz.

If you’d rather not have a timezone in your date column, then you will need to change the data type of the begin_lifespan_version column in PGAdmin. Hope this helps!

 

Regards,

Dan M

Reply