Skip to main content
Solved

Postgis writer with default values

  • March 8, 2024
  • 3 replies
  • 107 views

gvatin06
Contributor
Forum|alt.badge.img+2

I want to write lines into an existing PostGIS table, which has default values for most of the columns. With FME PostGIS Writer, when executing the process, I have errors returning (in french):
Bulk copy failed on table 'XXX' using delimiter ':'. Error was 'ERREUR:  une valeur NULL viole la contrainte NOT NULL de la colonne « YYY» dans la relation « XXX »

 

I would like to use the Postgres default values for these NOT NULL columns, but I cannot find the way to do it.

I use FME Form 2023.2

Best answer by david_r

Try removing (deleting) the relevant attributes from the writer.

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.

3 replies

gvatin06
Contributor
Forum|alt.badge.img+2
  • Author
  • Contributor
  • March 11, 2024

For a “quick fix”, I used SQLExecutor to execute INSERT with selected fields, and use the default values from Postgres when these are not provided in the INSERT. That does the job.

If anyone has a better idea to use the Postgis Writer, this would always be interesting.


david_r
Celebrity
  • Best Answer
  • March 12, 2024

Try removing (deleting) the relevant attributes from the writer.


tomgachet
Contributor
Forum|alt.badge.img+3
  • Contributor
  • March 14, 2024

I think @david_r is right!

 

Default values ​​are used by Postgres only if no data is inserted in the relevant fields.

 

If you leave these attributes even without specifying a value, postgres will translate it as a NULL value insertion, which will override the default value!