How to insert data of type "point" into a postgreSQL database

Overview

This article shows you a method of inserting data of type "point" into a postgreSQL database.

 

Environment

Talend Studio (5.3.1)

PostgreSQL (9.2)

 

Symptoms/Description

You may want to insert data of type "point", such as (5.829024,44.16855), from a CSV file into a database table using a simple job composed of tFileInputDelimitedtPostgresqlOutput components. You can do this as follows:

issueJob.jpg

Unfortunately, you will get a PSQLException like this:

 

org.postgresql.util.PSQLException: ERROR: column "point" is of type point but expression is of type character varying

 

Resolution

To resolve the issue, a workaround is to divide the input object into two columns and then, in an added tMap component, merge these two columns by using the following expression:

[new org.postgresql.geometric.PGpoint(row.point_1,row.point_2)]

mergeData.jpg

runOk.jpg

Version history
Revision #:
6 of 6
Last update:
‎05-04-2017 10:09 PM
Updated by:
 
Labels (1)
Tags (1)