Solved

Postgis writer with default values

  • 8 March 2024
  • 3 replies
  • 45 views

Badge +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

icon

Best answer by david_r 12 March 2024, 09:44

View original

3 replies

Badge +2

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.

Userlevel 5

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

Badge +3

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!

 

Reply