Skip to main content
Solved

Postgis writer with default values


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.

View original
Did this help you find an answer to your question?

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!

 

Cookie policy

We use cookies to enhance and personalize your experience. If you accept you agree to our full cookie policy. Learn more about our cookies.

 
Cookie settings